jasmine-pit

Writing tests for promises in jasmine is kind of a pain in the ass. jasmine-pit makes doing such things a tiny bit easier by providing an augmented version of `it()` (called `pit()`) that allows you to simply return a promise that may eventually assert ex

MIT 8 个版本
安装
npm install jasmine-pit
yarn add jasmine-pit
pnpm add jasmine-pit
bun add jasmine-pit
README

jasmine-pit

Writing tests for promises in jasmine is kind of a pain in the ass. jasmine-pit makes doing such things a tiny bit easier by providing an augmented version of it() (called pit()) that allows you to simply return a promise that may eventually assert expect()s (or propogate errors).

Example


jasminePit.install(window);

describe('MyTestSuite', functtion() {
  pit('Spec 1', function() {
    return funcThatReturnsPromise().then(function(stuff) {
      expect(stuff).toBe(stuff_i_expect_it_to_be);
    });
  });
});

This will execute the promise chain and, if any errors occur along the way, they will be propogated up to jasmine and reported as normal.

Don't be afraid to take a look at the source. The definition for pit() is stupid simple.

版本列表
2.0.2 2015-03-01
2.0.1 2015-02-28
2.0.0 2014-11-03
1.0.4 2014-07-16
1.0.3 2014-07-16
1.0.2 2013-12-23
1.0.1 2013-12-11
1.0.0 2013-12-11