UNPKG

779 BJavaScriptView Raw
1// This file exports a version of the Jasmine `it` that understands promises.
2// To use this, simply `import {it} from './spec-utils`.
3// TODO(hansl): move this to its own Jasmine-TypeScript package.
4"use strict";
5function async(fn) {
6 return function (done) {
7 var result = null;
8 try {
9 result = fn();
10 if (result && 'then' in result) {
11 result.then(done, done.fail);
12 }
13 else {
14 done();
15 }
16 }
17 catch (err) {
18 done.fail(err);
19 }
20 };
21}
22function it(description, fn) {
23 return global['it'](description, async(fn));
24}
25exports.it = it;
26//# sourceMappingURL=/Users/hans/Sources/angular-cli/packages/@angular-cli/ast-tools/src/spec-utils.js.map
\No newline at end of file