This package has been deprecated

Author message:

Please use jasmine-promise instead.

jasmine-await
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

jasmine-await

build status

This project adds asyncawait support to jasmine.

It extends the functions it(), beforeEach(), afterEach(), beforeAll() and afterAll() and wraps them in the async() function. So you can always use await() to wait for a promise's resolution or rejection.

Installation

npm i -D jasmine-await

Usage

Example1:

var async = require("jasmine-await");
var it = async.it;
var await = async.await;
 
it("should work", () => {
  var x = await(new Promise(res => res(42)));
  expect(x).toBe(42);
})

Example2 (same test, using typescript with jasmine-ts):

import {it, await} from "jasmine-await"
 
it("should work", () => {
  let x = await(new Promise(res => res(42)));
  expect(x).toBe(42);
})

Note

You still need to install the typings for jasmine to make the typescript-compiler happy about your specs:

typings i -D --ambient jasmine

Dependencies (2)

Dev Dependencies (5)

Package Sidebar

Install

npm i jasmine-await

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • svi3c