North Pittsburgh Meatpackers
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    jasmine-awaitpublic

    This package has been deprecated

    Author message:

    Please use jasmine-promise instead.

    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

    install

    npm i jasmine-await

    Downloadslast 7 days

    168

    version

    0.0.3

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar