jasmine-await

WebJar for jasmine-await

License

License

MIT
Categories

Categories

ASM Application Layer Libs Bytecode Manipulation
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

jasmine-await
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

jasmine-await
WebJar for jasmine-await
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/svi3c/jasmine-await

Download jasmine-await

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/jasmine-await/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>jasmine-await</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/jasmine-await/
implementation 'org.webjars.npm:jasmine-await:0.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/jasmine-await/
implementation ("org.webjars.npm:jasmine-await:0.0.2")
'org.webjars.npm:jasmine-await:jar:0.0.2'
<dependency org="org.webjars.npm" name="jasmine-await" rev="0.0.2">
  <artifact name="jasmine-await" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='jasmine-await', version='0.0.2')
)
libraryDependencies += "org.webjars.npm" % "jasmine-await" % "0.0.2"
[org.webjars.npm/jasmine-await "0.0.2"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm » asyncawait jar [1.0.3,2)
org.webjars.npm : jasmine jar [2.4.1,3)

Project Modules

There are no modules declared in this project.

jasmine-await

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.

Deprecation notice

This package is deprecated. Please use jasmine-promise-wrapper instead.

jasmine-promise is not bound to the asyncawait library. Of course you can still use this library, but if you have a runtime with native support for ES2017 async functions (node 7.6+), you don't need it any more. Since async functions return promises, async functions are covered by jasmine-promise as well: Simply declare your spec functions as async.

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

Versions

Version
0.0.2