source: trip-planner-front/node_modules/karma-jasmine-html-reporter/src/lib/adapter.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.4 KB
Line 
1(function (window) {
2
3 /**
4 * 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.
5 */
6 jasmineRequire.html(jasmine);
7
8 /**
9 * Create the Jasmine environment. This is used to run all specs in a project.
10 */
11 var env = jasmine.getEnv();
12
13 /**
14 * ## Runner Parameters
15 *
16 * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
17 */
18
19 var queryString = new jasmine.QueryString({
20 getWindowLocation: function () { return window.location; }
21 });
22
23 var filterSpecs = !!queryString.getParam("spec");
24
25 var config = {
26 failFast: queryString.getParam("failFast"),
27 oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
28 hideDisabled: queryString.getParam("hideDisabled")
29 };
30
31 var random = queryString.getParam("random");
32
33 if (random !== undefined && random !== "") {
34 config.random = random;
35 }
36
37 var seed = queryString.getParam("seed");
38 if (seed) {
39 config.seed = seed;
40 }
41
42 /**
43 * ## Reporters
44 * 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).
45 */
46 var htmlReporter = new jasmine.HtmlReporter({
47 env: env,
48 navigateWithNewParam: function (key, value) { return queryString.navigateWithNewParam(key, value); },
49 addToExistingQueryString: function (key, value) { return queryString.fullStringWithNewParam(key, value); },
50 getContainer: function () { return document.body; },
51 createElement: function () { return document.createElement.apply(document, arguments); },
52 createTextNode: function () { return document.createTextNode.apply(document, arguments); },
53 timer: new jasmine.Timer(),
54 filterSpecs: filterSpecs
55 });
56
57 env.addReporter(htmlReporter);
58
59 /**
60 * Filter which specs will be run by matching the start of the full name against the `spec` query param.
61 */
62 var specFilter;
63 if (queryString.getParam("spec")) {
64 specFilter = new jasmine.HtmlSpecFilter({
65 filterString: function () { return queryString.getParam("spec"); }
66 });
67
68 config.specFilter = function (spec) {
69 return specFilter.matches(spec.getFullName());
70 };
71 }
72
73 env.configure(config);
74
75 htmlReporter.initialize();
76
77})(window);
Note: See TracBrowser for help on using the repository browser.