Skip to content

Adds async function to jasmine suite function that expect promises for asynchronous tests

License

Notifications You must be signed in to change notification settings

rdy/jasmine-async-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jasmine-async-suite

Adds async function to jasmine suite function that expect promises for asynchronous tests.

To install:

var jasmineAsync = require('jasmine-async-suite');
jasmineAsync.install();

Uninstalling:

afterAll(function() {
  var jasmineAsync = require('jasmine-async-suite');
  jasmineAsync.uninstall();
});

For example the following async test:

  function timeout() {
    return new Promise(function(resolve) {
      setTimeout(resolve, 1000);
    });
  }

  it('passes when enough time has passed', function(done) {
    timeout().then(done);
  });    

Becomes:

  it.async('passes when enough time has passed', function() {
    return timeout();  
  });    

It works and looks even better with the proposed ES7 async/await syntax

  it.async('passes when enough time has passed', async function() {
    await timeout();  
  });    

(c) Copyright 2016 Ryan Dy. All Rights Reserved.

About

Adds async function to jasmine suite function that expect promises for asynchronous tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published