|
1 | 1 | /**
|
2 |
| - This is a version of Jasmine's boot.js modified to work with specs defined with AMD. The original comments from boot.js follow. |
| 2 | + This is a version of Jasmine's boot.js modified to work with specs defined with ES6. The original comments from boot.js follow. |
3 | 3 |
|
4 | 4 | Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
5 | 5 |
|
|
10 | 10 | [jasmine-gem]: http://github.com/pivotal/jasmine-gem
|
11 | 11 | */
|
12 | 12 |
|
13 |
| -/*global require*/ |
| 13 | +import * as Cesium from '../Source/Cesium.js'; |
| 14 | +import addDefaultMatchers from './addDefaultMatchers.js'; |
| 15 | +import equalsMethodEqualityTester from './equalsMethodEqualityTester.js'; |
14 | 16 |
|
15 |
| -(function() { |
16 |
| - 'use strict'; |
| 17 | + // set this for uniform test resolution across devices |
| 18 | + window.devicePixelRatio = 1; |
17 | 19 |
|
18 |
| - // set this for uniform test resolution across devices |
19 |
| - window.devicePixelRatio = 1; |
20 |
| - |
21 |
| - function getQueryParameter(name) { |
22 |
| - var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); |
23 |
| - return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); |
24 |
| - } |
25 |
| - |
26 |
| - var built = getQueryParameter('built'); |
27 |
| - var release = getQueryParameter('release'); |
28 |
| - |
29 |
| - var toRequire = ['Cesium']; |
30 |
| - |
31 |
| - if (built) { |
32 |
| - require.config({ |
33 |
| - waitSeconds: 30, |
34 |
| - baseUrl: getQueryParameter('baseUrl') || '../Build/Cesium', |
35 |
| - paths: { |
36 |
| - 'Stubs': '../Stubs', |
37 |
| - 'Specs': '../../Specs', |
38 |
| - 'Source' : '../../Source' |
39 |
| - }, |
40 |
| - shim: { |
41 |
| - 'Cesium': { |
42 |
| - exports: 'Cesium' |
43 |
| - } |
44 |
| - } |
45 |
| - }); |
46 |
| - |
47 |
| - toRequire.push('./Stubs/paths'); |
48 |
| - } else { |
49 |
| - require.config({ |
50 |
| - waitSeconds: 30, |
51 |
| - baseUrl: getQueryParameter('baseUrl') || '../Source', |
52 |
| - paths: { |
53 |
| - 'Specs': '../Specs', |
54 |
| - 'Source' : '.' |
55 |
| - } |
56 |
| - }); |
57 |
| - } |
| 20 | + function getQueryParameter(name) { |
| 21 | + var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); |
| 22 | + return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); |
| 23 | + } |
58 | 24 |
|
59 |
| - require(toRequire, function( |
60 |
| - Cesium, |
61 |
| - paths) { |
| 25 | + var built = getQueryParameter('built'); |
| 26 | + var release = getQueryParameter('release'); |
62 | 27 |
|
63 | 28 | /*global jasmineRequire,jasmine,exports,specs*/
|
64 | 29 |
|
65 | 30 | var when = Cesium.when;
|
66 | 31 |
|
67 |
| - if (typeof paths !== 'undefined') { |
68 |
| - require.config({ |
69 |
| - paths : paths |
70 |
| - }); |
71 |
| - } |
72 |
| - |
73 | 32 | /**
|
74 | 33 | * ## Require & Instantiate
|
75 | 34 | *
|
|
346 | 305 | *
|
347 | 306 | * Load the modules via AMD, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment.
|
348 | 307 | */
|
349 |
| - var modules = ['Specs/addDefaultMatchers', 'Specs/equalsMethodEqualityTester'].concat(specs); |
350 |
| - require(modules, function(addDefaultMatchers, equalsMethodEqualityTester) { |
351 |
| - jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; |
352 | 308 |
|
353 |
| - htmlReporter.initialize(); |
| 309 | + jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; |
354 | 310 |
|
355 |
| - var release = getQueryParameter('release'); |
356 |
| - env.beforeEach(function() { addDefaultMatchers(!release).call(env); }); |
357 |
| - env.beforeEach(function() { env.addCustomEqualityTester(equalsMethodEqualityTester); }); |
| 311 | + htmlReporter.initialize(); |
358 | 312 |
|
| 313 | + var release = getQueryParameter('release'); |
| 314 | + env.beforeEach(function() { addDefaultMatchers(!release).call(env); }); |
| 315 | + env.beforeEach(function() { env.addCustomEqualityTester(equalsMethodEqualityTester); }); |
| 316 | + |
| 317 | + import('./SpecList.js').then(function() { |
359 | 318 | env.execute();
|
360 |
| - }); |
361 |
| - }); |
362 |
| -})(); |
| 319 | + }) |
0 commit comments