yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/**
 This is a version of Jasmine's boot.js modified to work with specs defined with ES6.  The original comments from boot.js follow.
 
 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.
 
 If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
 
 The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
 
 [jasmine-gem]: http://github.com/pivotal/jasmine-gem
 */
 
// Use a pragma so we can remove this code when building specs for running in ES5
 
//>>includeStart('debug', pragmas.debug);
import * as Cesium from "../Source/Cesium.js";
//>>includeEnd('debug');
 
import addDefaultMatchers from "./addDefaultMatchers.js";
import equalsMethodEqualityTester from "./equalsMethodEqualityTester.js";
 
// set this for uniform test resolution across devices
window.devicePixelRatio = 1;
 
function getQueryParameter(name) {
  var match = new RegExp("[?&]" + name + "=([^&]*)").exec(
    window.location.search
  );
  return match && decodeURIComponent(match[1].replace(/\+/g, " "));
}
 
var release = getQueryParameter("release");
 
/*global jasmineRequire,jasmine,exports,specs*/
 
var when = Cesium.when;
 
/**
 * ## Require & Instantiate
 *
 * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
 */
window.jasmine = jasmineRequire.core(jasmineRequire);
 
window.specsUsingRelease = release;
 
/**
 * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
 */
jasmineRequire.html(jasmine);
 
/**
 * Create the Jasmine environment. This is used to run all specs in a project.
 */
var env = jasmine.getEnv();
 
/**
 * ## The Global Interface
 *
 * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
 */
var jasmineInterface = jasmineRequire["interface"](jasmine, env);
 
/**
 * Helper function for readability below.
 */
function extend(destination, source) {
  for (var property in source) {
    if (source.hasOwnProperty(property)) {
      destination[property] = source[property];
    }
  }
  return destination;
}
 
/**
 * Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
 */
if (typeof window === "undefined" && typeof exports === "object") {
  extend(exports, jasmineInterface);
} else {
  extend(window, jasmineInterface);
}
 
// Override beforeEach(), afterEach(), beforeAll(), afterAll(), and it() to automatically
// call done() when a returned promise resolves.
var originalIt = window.it;
 
window.it = function (description, f, timeout, categories) {
  originalIt(
    description,
    function (done) {
      var result = f();
      when(
        result,
        function () {
          done();
        },
        function (e) {
          done.fail("promise rejected: " + e.toString());
        }
      );
    },
    timeout,
    categories
  );
};
 
var originalFit = window.fit;
 
window.fit = function (description, f, timeout, categories) {
  originalFit(
    description,
    function (done) {
      var result = f();
      when(
        result,
        function () {
          done();
        },
        function (e) {
          done.fail("promise rejected: " + e.toString());
        }
      );
    },
    timeout,
    categories
  );
};
 
var originalBeforeEach = window.beforeEach;
 
window.beforeEach = function (f) {
  originalBeforeEach(function (done) {
    var result = f();
    when(
      result,
      function () {
        done();
      },
      function (e) {
        done.fail("promise rejected: " + e.toString());
      }
    );
  });
};
 
var originalAfterEach = window.afterEach;
 
window.afterEach = function (f) {
  originalAfterEach(function (done) {
    var result = f();
    when(
      result,
      function () {
        done();
      },
      function (e) {
        done.fail("promise rejected: " + e.toString());
      }
    );
  });
};
 
var originalBeforeAll = window.beforeAll;
 
window.beforeAll = function (f) {
  originalBeforeAll(function (done) {
    var result = f();
    when(
      result,
      function () {
        done();
      },
      function (e) {
        done.fail("promise rejected: " + e.toString());
      }
    );
  });
};
 
var originalAfterAll = window.afterAll;
 
window.afterAll = function (f) {
  originalAfterAll(function (done) {
    var result = f();
    when(
      result,
      function () {
        done();
      },
      function (e) {
        done.fail("promise rejected: " + e.toString());
      }
    );
  });
};
 
/**
 * ## Runner Parameters
 *
 * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
 */
 
var queryString = Cesium.queryToObject(window.location.search.substring(1));
 
if (queryString.webglValidation !== undefined) {
  window.webglValidation = true;
}
 
if (queryString.webglStub !== undefined) {
  window.webglStub = true;
}
 
var queryStringForSpecFocus = Cesium.clone(queryString);
if (queryStringForSpecFocus.category === "none") {
  delete queryStringForSpecFocus.category;
}
 
var catchingExceptions = queryString["catch"];
env.catchExceptions(
  typeof catchingExceptions === "undefined" ? true : catchingExceptions
);
 
/**
 * ## Reporters
 * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
 */
var htmlReporter = new jasmine.HtmlReporter({
  env: env,
  onRaiseExceptionsClick: function () {
    queryString["catch"] = !env.catchingExceptions();
  },
  addToExistingQueryString: function (key, value) {
    queryStringForSpecFocus[key] = value;
    return "?" + Cesium.objectToQuery(queryStringForSpecFocus);
  },
  getContainer: function () {
    return document.body;
  },
  createElement: function () {
    return document.createElement.apply(document, arguments);
  },
  createTextNode: function () {
    return document.createTextNode.apply(document, arguments);
  },
  timer: new jasmine.Timer(),
});
 
/**
 * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results  from JavaScript.
 */
env.addReporter(jasmineInterface.jsApiReporter);
env.addReporter(htmlReporter);
 
var categoryString = queryString.category;
 
var categories;
if (categoryString) {
  categories = categoryString.split(",");
}
 
var notCategoryString = queryString.not;
 
var notCategories;
if (notCategoryString) {
  notCategories = notCategoryString.split(",");
}
 
/**
 * Filter which specs will be run by matching the start of the full name against the `spec` query param.
 */
var specFilter = new jasmine.HtmlSpecFilter({
  filterString: function () {
    return queryString.spec;
  },
});
 
env.specFilter = function (spec) {
  if (!specFilter.matches(spec.getFullName())) {
    return false;
  }
 
  // If we're not filtering by category, include this spec.
  if (!categories && !notCategories) {
    return true;
  }
 
  // At least one of this spec's categories must match one of the selected categories.
  var keep = false;
  var toCheck;
  var i;
 
  if (categories && categories.indexOf("All") < 0) {
    toCheck = spec;
    while (!keep && toCheck) {
      if (toCheck.categories) {
        if (categories.indexOf(toCheck.categories) >= 0) {
          keep = true;
        }
 
        for (i = 0; !keep && i < toCheck.categories.length; ++i) {
          if (categories.indexOf(toCheck.categories[i]) >= 0) {
            keep = true;
          }
        }
      }
 
      toCheck = toCheck.parentSuite;
    }
  } else {
    keep = true;
  }
 
  if (notCategories) {
    toCheck = spec;
    while (keep && toCheck) {
      if (toCheck.categories) {
        if (notCategories.indexOf(toCheck.categories) >= 0) {
          keep = false;
        }
 
        for (i = 0; keep && i < toCheck.categories.length; ++i) {
          if (categories.indexOf(toCheck.categories[i]) >= 0) {
            keep = false;
          }
        }
      }
 
      toCheck = toCheck.parentSuite;
    }
  }
 
  return keep;
};
 
/**
 * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
 */
window.setTimeout = window.setTimeout;
window.setInterval = window.setInterval;
window.clearTimeout = window.clearTimeout;
window.clearInterval = window.clearInterval;
 
/**
 * ## Execution
 *
 * 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.
 */
 
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
 
htmlReporter.initialize();
 
var release = getQueryParameter("release");
env.beforeEach(function () {
  addDefaultMatchers(!release).call(env);
});
env.beforeEach(function () {
  env.addCustomEqualityTester(equalsMethodEqualityTester);
});
 
//>>includeStart('debug', pragmas.debug);
import("./SpecList.js").then(function () {
  env.execute();
});
//>>includeEnd('debug');