|
| 1 | +import {ifEnvSupports} from './test-util'; |
1 | 2 | /**
|
2 | 3 | * @license
|
3 | 4 | * Copyright Google Inc. All Rights Reserved.
|
|
6 | 7 | * found in the LICENSE file at https://angular.io/license
|
7 | 8 | */
|
8 | 9 |
|
9 |
| -beforeEach(() => { |
10 |
| - // assert that each jasmine run has a task, so that drainMicrotask works properly. |
11 |
| - expect(Zone.currentTask).toBeTruthy(); |
12 |
| -}); |
| 10 | +ifEnvSupports(() => jasmine && jasmine['Spec'], () => { |
| 11 | + beforeEach(() => { |
| 12 | + // assert that each jasmine run has a task, so that drainMicrotask works properly. |
| 13 | + expect(Zone.currentTask).toBeTruthy(); |
| 14 | + }); |
13 | 15 |
|
14 |
| -describe('jasmine', () => { |
15 |
| - let throwOnAsync = false; |
16 |
| - let beforeEachZone: Zone = null; |
17 |
| - let itZone: Zone = null; |
18 |
| - const syncZone = Zone.current; |
19 |
| - try { |
20 |
| - Zone.current.scheduleMicroTask('dontallow', () => null); |
21 |
| - } catch (e) { |
22 |
| - throwOnAsync = true; |
23 |
| - } |
| 16 | + describe('jasmine', () => { |
| 17 | + let throwOnAsync = false; |
| 18 | + let beforeEachZone: Zone = null; |
| 19 | + let itZone: Zone = null; |
| 20 | + const syncZone = Zone.current; |
| 21 | + try { |
| 22 | + Zone.current.scheduleMicroTask('dontallow', () => null); |
| 23 | + } catch (e) { |
| 24 | + throwOnAsync = true; |
| 25 | + } |
24 | 26 |
|
25 |
| - beforeEach(() => beforeEachZone = Zone.current); |
| 27 | + beforeEach(() => beforeEachZone = Zone.current); |
26 | 28 |
|
27 |
| - it('should throw on async in describe', () => { |
28 |
| - expect(throwOnAsync).toBe(true); |
29 |
| - expect(syncZone.name).toEqual('syncTestZone for jasmine.describe'); |
30 |
| - itZone = Zone.current; |
31 |
| - }); |
| 29 | + it('should throw on async in describe', () => { |
| 30 | + expect(throwOnAsync).toBe(true); |
| 31 | + expect(syncZone.name).toEqual('syncTestZone for jasmine.describe'); |
| 32 | + itZone = Zone.current; |
| 33 | + }); |
32 | 34 |
|
33 |
| - afterEach(() => { |
34 |
| - let zone = Zone.current; |
35 |
| - expect(zone.name).toEqual('ProxyZone'); |
36 |
| - expect(beforeEachZone).toBe(zone); |
37 |
| - expect(itZone).toBe(zone); |
38 |
| - }); |
| 35 | + it('should cope with pending tests, which have no test body'); |
39 | 36 |
|
40 |
| -}); |
| 37 | + afterEach(() => { |
| 38 | + let zone = Zone.current; |
| 39 | + expect(zone.name).toEqual('ProxyZone'); |
| 40 | + expect(beforeEachZone).toBe(zone); |
| 41 | + expect(itZone).toBe(zone); |
| 42 | + }); |
41 | 43 |
|
42 |
| -export let _something_so_that_i_am_treated_as_es6_module; |
| 44 | + }); |
| 45 | +})(); |
0 commit comments