Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jasmine-await

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-await

Integrates asyncawait support into jasmine to write more concise specs

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 30 Jan 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc