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

1.0.0 • Public • Published

jasmine-ts-async

Simple asynchronous wrappers for jasmine functions written in typescript.

This library is based off of jasmine-promise-wrapper. The key differences are:

  • Does not use the same names as jasmine functions, so the two can live side by side
  • Compiled to an older ES version, so it is compatible with PhantomJS
  • Built specifically for typescript async/await

Examples

import {$it, $beforeAll, $beforeEach, $afterEach, $afterAll} from 'jasmine-ts-async';
 
describe('myTestSuite', () =>{
    let x:number;
    let y:number;
    let sut:MySutClass;
    $beforeAll(async () =>{
       y = await someAsyncAction();
    });
 
    $beforeEach(async () =>{
       x = await someOtherAsyncAction();
       sut = new MySutClass(x);
    });
 
    $afterEach(async () => {
        await sut.tearDownFunction();
    });
 
    $afterAll(async () =>{
      await someTearDownFunction();
    })
 
    $it(async () =>{
        let result = await sut.someAsyncMethod(y);
        expect(result).toBe(42);
    });
});
    

Prerequisites

To use this library you must also have jasmine installed.

npm install --save-dev jasmine

or

npm install --save-dev karma-jasmine

Installation

npm install --save-dev jasmine-ts-async

License

MIT - view the full license here

Package Sidebar

Install

npm i jasmine-ts-async

Weekly Downloads

21

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mdvorscak