Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
jasmine-promise-wrapper
Advanced tools
This library shall simplify promise handling within jasmine. To achieve this, it provides some wrapper functions which can handle returned promises. The specs will wait for the resolution or rejection of those promises.
The following wrapping functions are exported by this library:
it(description, fn, timeout)
beforeEach(fn, timeout)
afterEach(fn, timeout)
beforeAll(fn, timeout)
afterAll(fn, timeout)
Additionaly there is an invert(promise)
function that takes promise
and returns an inverted promise that is rejected with the original
resolution or resolved with the original rejection.
This comes in handy when expecting promises to be rejected.
import {it} from "jasmine-promise-wrapper";
const unit = () =>
new Promise(resolve =>
setTimeout(() => resolve("success"), 1000));
it("should wait for a promise", () => {
return unit()
.then(result => {
expect(result).toBe("success");
});
});
// alternative with implicit returns:
it("should wait for a promise", () =>
unit()
.then(result =>
expect(result).toBe("success")));
// alternative with async/await:
it("should wait for a promise", async () => {
const result = await unit();
expect(result).toBe("success");
});
FAQs
Promise handling for jasmine
The npm package jasmine-promise-wrapper receives a total of 1,454 weekly downloads. As such, jasmine-promise-wrapper popularity was classified as popular.
We found that jasmine-promise-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.