jasmine-core 3.4.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2f97eb23b1da29995d0fa9ea85c096b8e21c5ea3522a899047c167db7eea5d3
4
- data.tar.gz: 7dc28613f0d36c254d0bd7c02c5e13cd881131a600ffa37fed0af86dae99875b
3
+ metadata.gz: a1d57232cc4b128cad1a9e9ddbc94319bd2b56a24211eaae6e32fc1e5c181810
4
+ data.tar.gz: ca6ebdb25bc946e9b2abd7e71d22e2cdf22edf33ae86824ab5e7f07d9689cdba
5
5
  SHA512:
6
- metadata.gz: 9d291ed84e5c5489bf3da6d680cccdfc373ed2aa62fb9ceea2a57b07cbf1883ed50fbd1b331e38d2a0ca4f25edd50861c6ab2ea57c50694689a281e76a78994c
7
- data.tar.gz: 78ef4ce947e00b517e0c2e189615b174321f582552e9deabad5c7de1a71c24aa5d34e422d979f077ba2101d5b5ad9f0b04e2f03ccff7a896a01a087510608d64
6
+ metadata.gz: 0d7258d7339350d5bd68e4fa7da1b0170524f74a81c5ca1ca73f919924abde8efa98c1459bda1db2b89ca43973c821e93027ca8a0db720f67241a3aaa7b7c777
7
+ data.tar.gz: 61b1a8dfdb8d06916111340bd2a281ca0da8c102385ac5e011a7091d4813f9499928060686c3b92d15d2f6aeaec642f1036fc506f6448b917470b8e601ae070e
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright (c) 2008-2019 Pivotal Labs
2
+ Copyright (c) 2008-2021 Pivotal Labs
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
@@ -31,13 +31,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
31
  */
32
32
 
33
33
  (function() {
34
+ var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
34
35
 
35
36
  /**
36
37
  * ## Require & Instantiate
37
38
  *
38
39
  * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
39
40
  */
40
- window.jasmine = jasmineRequire.core(jasmineRequire);
41
+ var jasmine = jasmineRequire.core(jasmineRequire),
42
+ global = jasmine.getGlobal();
43
+ global.jasmine = jasmine;
41
44
 
42
45
  /**
43
46
  * 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.
@@ -59,7 +62,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
59
62
  /**
60
63
  * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
61
64
  */
62
- extend(window, jasmineInterface);
65
+ extend(global, jasmineInterface);
63
66
 
64
67
  /**
65
68
  * ## Runner Parameters
@@ -9,13 +9,16 @@
9
9
  */
10
10
 
11
11
  (function() {
12
+ var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
12
13
 
13
14
  /**
14
15
  * ## Require & Instantiate
15
16
  *
16
17
  * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
17
18
  */
18
- window.jasmine = jasmineRequire.core(jasmineRequire);
19
+ var jasmine = jasmineRequire.core(jasmineRequire),
20
+ global = jasmine.getGlobal();
21
+ global.jasmine = jasmine;
19
22
 
20
23
  /**
21
24
  * 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.
@@ -37,7 +40,7 @@
37
40
  /**
38
41
  * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
39
42
  */
40
- extend(window, jasmineInterface);
43
+ extend(global, jasmineInterface);
41
44
 
42
45
  /**
43
46
  * ## Runner Parameters
@@ -1,4 +1,33 @@
1
1
  import pkg_resources
2
+ import os
3
+
4
+ if 'SUPPRESS_JASMINE_DEPRECATION' not in os.environ:
5
+ print('DEPRECATION WARNING:\n' +
6
+ '\n' +
7
+ 'The Jasmine packages for Python are deprecated. There will be no further\n' +
8
+ 'releases after the end of the Jasmine 3.x series. We recommend migrating to the\n' +
9
+ 'following options:\n' +
10
+ '\n' +
11
+ '* jasmine-browser-runner (<https://github.com/jasmine/jasmine-browser>,\n' +
12
+ ' `npm install jasmine-browser-runner`) to run specs in browsers, including\n' +
13
+ ' headless Chrome and Saucelabs. This is the most direct replacement for the\n' +
14
+ ' jasmine server` and `jasmine ci` commands provided by the `jasmine` Python\n' +
15
+ ' package.\n' +
16
+ '* The jasmine npm package (<https://github.com/jasmine/jasmine-npm>,\n' +
17
+ ' `npm install jasmine`) to run specs under Node.js.\n' +
18
+ '* The standalone distribution from the latest Jasmine release\n' +
19
+ ' <https://github.com/jasmine/jasmine/releases> to run specs in browsers with\n' +
20
+ ' no additional tools.\n' +
21
+ '* The jasmine-core npm package (`npm install jasmine-core`) if all you need is\n' +
22
+ ' the Jasmine assets. This is the direct equivalent of the jasmine-core Python\n' +
23
+ ' package.\n' +
24
+ '\n' +
25
+ 'Except for the standalone distribution, all of the above are distributed through\n' +
26
+ 'npm.\n' +
27
+ '\n' +
28
+ 'To prevent this message from appearing, set the SUPPRESS_JASMINE_DEPRECATION\n' +
29
+ 'environment variable.\n')
30
+
2
31
 
3
32
  try:
4
33
  from collections import OrderedDict
@@ -19,4 +19,4 @@ Player.prototype.resume = function() {
19
19
 
20
20
  Player.prototype.makeFavorite = function() {
21
21
  this.currentlyPlayingSong.persistFavoriteStatus(true);
22
- };
22
+ };
@@ -4,4 +4,4 @@ function Song() {
4
4
  Song.prototype.persistFavoriteStatus = function(value) {
5
5
  // something complicated
6
6
  throw new Error("not yet implemented");
7
- };
7
+ };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright (c) 2008-2019 Pivotal Labs
2
+ Copyright (c) 2008-2021 Pivotal Labs
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
@@ -20,6 +20,8 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
20
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
+ var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
24
+
23
25
  jasmineRequire.html = function(j$) {
24
26
  j$.ResultsNode = jasmineRequire.ResultsNode();
25
27
  j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
@@ -52,8 +54,7 @@ jasmineRequire.HtmlReporter = function(j$) {
52
54
  }
53
55
  };
54
56
 
55
- ResultsStateBuilder.prototype.specStarted = function(result) {
56
- };
57
+ ResultsStateBuilder.prototype.specStarted = function(result) {};
57
58
 
58
59
  ResultsStateBuilder.prototype.specDone = function(result) {
59
60
  this.currentParent.addChild(result, 'spec');
@@ -71,32 +72,42 @@ jasmineRequire.HtmlReporter = function(j$) {
71
72
  }
72
73
  };
73
74
 
74
-
75
-
76
75
  function HtmlReporter(options) {
77
- var config = function() { return (options.env && options.env.configuration()) || {}; },
76
+ var config = function() {
77
+ return (options.env && options.env.configuration()) || {};
78
+ },
78
79
  getContainer = options.getContainer,
79
80
  createElement = options.createElement,
80
81
  createTextNode = options.createTextNode,
81
82
  navigateWithNewParam = options.navigateWithNewParam || function() {},
82
- addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
83
+ addToExistingQueryString =
84
+ options.addToExistingQueryString || defaultQueryString,
83
85
  filterSpecs = options.filterSpecs,
84
- timer = options.timer || j$.noopTimer,
85
86
  htmlReporterMain,
86
87
  symbols,
87
88
  deprecationWarnings = [];
88
89
 
89
90
  this.initialize = function() {
90
91
  clearPrior();
91
- htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
92
- createDom('div', {className: 'jasmine-banner'},
93
- createDom('a', {className: 'jasmine-title', href: 'http://jasmine.github.io/', target: '_blank'}),
94
- createDom('span', {className: 'jasmine-version'}, j$.version)
92
+ htmlReporterMain = createDom(
93
+ 'div',
94
+ { className: 'jasmine_html-reporter' },
95
+ createDom(
96
+ 'div',
97
+ { className: 'jasmine-banner' },
98
+ createDom('a', {
99
+ className: 'jasmine-title',
100
+ href: 'http://jasmine.github.io/',
101
+ target: '_blank'
102
+ }),
103
+ createDom('span', { className: 'jasmine-version' }, j$.version)
95
104
  ),
96
- createDom('ul', {className: 'jasmine-symbol-summary'}),
97
- createDom('div', {className: 'jasmine-alert'}),
98
- createDom('div', {className: 'jasmine-results'},
99
- createDom('div', {className: 'jasmine-failures'})
105
+ createDom('ul', { className: 'jasmine-symbol-summary' }),
106
+ createDom('div', { className: 'jasmine-alert' }),
107
+ createDom(
108
+ 'div',
109
+ { className: 'jasmine-results' },
110
+ createDom('div', { className: 'jasmine-failures' })
100
111
  )
101
112
  );
102
113
  getContainer().appendChild(htmlReporterMain);
@@ -105,10 +116,9 @@ jasmineRequire.HtmlReporter = function(j$) {
105
116
  var totalSpecsDefined;
106
117
  this.jasmineStarted = function(options) {
107
118
  totalSpecsDefined = options.totalSpecsDefined || 0;
108
- timer.start();
109
119
  };
110
120
 
111
- var summary = createDom('div', {className: 'jasmine-summary'});
121
+ var summary = createDom('div', { className: 'jasmine-summary' });
112
122
 
113
123
  var stateBuilder = new ResultsStateBuilder();
114
124
 
@@ -122,7 +132,7 @@ jasmineRequire.HtmlReporter = function(j$) {
122
132
  if (result.status === 'failed') {
123
133
  failures.push(failureDom(result));
124
134
  }
125
- addDeprecationWarnings(result);
135
+ addDeprecationWarnings(result, 'suite');
126
136
  };
127
137
 
128
138
  this.specStarted = function(result) {
@@ -133,35 +143,45 @@ jasmineRequire.HtmlReporter = function(j$) {
133
143
  this.specDone = function(result) {
134
144
  stateBuilder.specDone(result);
135
145
 
136
- if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
137
- console.error('Spec \'' + result.fullName + '\' has no expectations.');
146
+ if (noExpectations(result)) {
147
+ var noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
148
+ if (result.status === 'failed') {
149
+ console.error(noSpecMsg);
150
+ } else {
151
+ console.warn(noSpecMsg);
152
+ }
138
153
  }
139
154
 
140
- if (!symbols){
155
+ if (!symbols) {
141
156
  symbols = find('.jasmine-symbol-summary');
142
157
  }
143
158
 
144
- symbols.appendChild(createDom('li', {
159
+ symbols.appendChild(
160
+ createDom('li', {
145
161
  className: this.displaySpecInCorrectFormat(result),
146
162
  id: 'spec_' + result.id,
147
163
  title: result.fullName
148
- }
149
- ));
164
+ })
165
+ );
150
166
 
151
167
  if (result.status === 'failed') {
152
168
  failures.push(failureDom(result));
153
169
  }
154
170
 
155
- addDeprecationWarnings(result);
171
+ addDeprecationWarnings(result, 'spec');
156
172
  };
157
173
 
158
174
  this.displaySpecInCorrectFormat = function(result) {
159
- return noExpectations(result) ? 'jasmine-empty' : this.resultStatus(result.status);
175
+ return noExpectations(result) && result.status === 'passed'
176
+ ? 'jasmine-empty'
177
+ : this.resultStatus(result.status);
160
178
  };
161
179
 
162
180
  this.resultStatus = function(status) {
163
- if(status === 'excluded') {
164
- return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
181
+ if (status === 'excluded') {
182
+ return config().hideDisabled
183
+ ? 'jasmine-excluded-no-display'
184
+ : 'jasmine-excluded';
165
185
  }
166
186
  return 'jasmine-' + status;
167
187
  };
@@ -171,16 +191,36 @@ jasmineRequire.HtmlReporter = function(j$) {
171
191
  var alert = find('.jasmine-alert');
172
192
  var order = doneResult && doneResult.order;
173
193
  var i;
174
- alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
194
+ alert.appendChild(
195
+ createDom(
196
+ 'span',
197
+ { className: 'jasmine-duration' },
198
+ 'finished in ' + doneResult.totalTime / 1000 + 's'
199
+ )
200
+ );
175
201
 
176
202
  banner.appendChild(optionsMenu(config()));
177
203
 
178
204
  if (stateBuilder.specsExecuted < totalSpecsDefined) {
179
- var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
180
- var skippedLink = addToExistingQueryString('spec', '');
205
+ var skippedMessage =
206
+ 'Ran ' +
207
+ stateBuilder.specsExecuted +
208
+ ' of ' +
209
+ totalSpecsDefined +
210
+ ' specs - run all';
211
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
212
+ var skippedLink =
213
+ (window.location.pathname || '') +
214
+ addToExistingQueryString('spec', '');
181
215
  alert.appendChild(
182
- createDom('span', {className: 'jasmine-bar jasmine-skipped'},
183
- createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage)
216
+ createDom(
217
+ 'span',
218
+ { className: 'jasmine-bar jasmine-skipped' },
219
+ createDom(
220
+ 'a',
221
+ { href: skippedLink, title: 'Run all specs' },
222
+ skippedMessage
223
+ )
184
224
  )
185
225
  );
186
226
  }
@@ -190,34 +230,66 @@ jasmineRequire.HtmlReporter = function(j$) {
190
230
  var failed = stateBuilder.failureCount + globalFailures.length > 0;
191
231
 
192
232
  if (totalSpecsDefined > 0 || failed) {
193
- statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount);
194
- if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); }
233
+ statusBarMessage +=
234
+ pluralize('spec', stateBuilder.specsExecuted) +
235
+ ', ' +
236
+ pluralize('failure', stateBuilder.failureCount);
237
+ if (stateBuilder.pendingSpecCount) {
238
+ statusBarMessage +=
239
+ ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount);
240
+ }
195
241
  }
196
242
 
197
243
  if (doneResult.overallStatus === 'passed') {
198
244
  statusBarClassName += ' jasmine-passed ';
199
245
  } else if (doneResult.overallStatus === 'incomplete') {
200
246
  statusBarClassName += ' jasmine-incomplete ';
201
- statusBarMessage = 'Incomplete: ' + doneResult.incompleteReason + ', ' + statusBarMessage;
247
+ statusBarMessage =
248
+ 'Incomplete: ' +
249
+ doneResult.incompleteReason +
250
+ ', ' +
251
+ statusBarMessage;
202
252
  } else {
203
253
  statusBarClassName += ' jasmine-failed ';
204
254
  }
205
255
 
206
256
  var seedBar;
207
257
  if (order && order.random) {
208
- seedBar = createDom('span', {className: 'jasmine-seed-bar'},
258
+ seedBar = createDom(
259
+ 'span',
260
+ { className: 'jasmine-seed-bar' },
209
261
  ', randomized with seed ',
210
- createDom('a', {title: 'randomized with seed ' + order.seed, href: seedHref(order.seed)}, order.seed)
262
+ createDom(
263
+ 'a',
264
+ {
265
+ title: 'randomized with seed ' + order.seed,
266
+ href: seedHref(order.seed)
267
+ },
268
+ order.seed
269
+ )
211
270
  );
212
271
  }
213
272
 
214
- alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
273
+ alert.appendChild(
274
+ createDom(
275
+ 'span',
276
+ { className: statusBarClassName },
277
+ statusBarMessage,
278
+ seedBar
279
+ )
280
+ );
215
281
 
216
282
  var errorBarClassName = 'jasmine-bar jasmine-errored';
217
283
  var afterAllMessagePrefix = 'AfterAll ';
218
284
 
219
- for(i = 0; i < globalFailures.length; i++) {
220
- alert.appendChild(createDom('span', {className: errorBarClassName}, globalFailureMessage(globalFailures[i])));
285
+ for (i = 0; i < globalFailures.length; i++) {
286
+ alert.appendChild(
287
+ createDom(
288
+ 'span',
289
+ { className: errorBarClassName },
290
+ globalFailureMessage(globalFailures[i])
291
+ )
292
+ );
221
293
  }
222
294
 
223
295
  function globalFailureMessage(failure) {
@@ -225,7 +297,9 @@ jasmineRequire.HtmlReporter = function(j$) {
225
297
  var prefix = 'Error during loading: ' + failure.message;
226
298
 
227
299
  if (failure.filename) {
228
- return prefix + ' in ' + failure.filename + ' line ' + failure.lineno;
300
+ return (
301
+ prefix + ' in ' + failure.filename + ' line ' + failure.lineno
302
+ );
229
303
  } else {
230
304
  return prefix;
231
305
  }
@@ -236,10 +310,29 @@ jasmineRequire.HtmlReporter = function(j$) {
236
310
 
237
311
  addDeprecationWarnings(doneResult);
238
312
 
239
- var warningBarClassName = 'jasmine-bar jasmine-warning';
240
- for(i = 0; i < deprecationWarnings.length; i++) {
241
- var warning = deprecationWarnings[i];
242
- alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
313
+ for (i = 0; i < deprecationWarnings.length; i++) {
314
+ var context;
315
+
316
+ switch (deprecationWarnings[i].runnableType) {
317
+ case 'spec':
318
+ context = '(in spec: ' + deprecationWarnings[i].runnableName + ')';
319
+ break;
320
+ case 'suite':
321
+ context = '(in suite: ' + deprecationWarnings[i].runnableName + ')';
322
+ break;
323
+ default:
324
+ context = '';
325
+ }
326
+
327
+ alert.appendChild(
328
+ createDom(
329
+ 'span',
330
+ { className: 'jasmine-bar jasmine-warning' },
331
+ 'DEPRECATION: ' + deprecationWarnings[i].message,
332
+ createDom('br'),
333
+ context
334
+ )
335
+ );
243
336
  }
244
337
 
245
338
  var results = find('.jasmine-results');
@@ -249,19 +342,37 @@ jasmineRequire.HtmlReporter = function(j$) {
249
342
 
250
343
  if (failures.length) {
251
344
  alert.appendChild(
252
- createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
345
+ createDom(
346
+ 'span',
347
+ { className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
253
348
  createDom('span', {}, 'Spec List | '),
254
- createDom('a', {className: 'jasmine-failures-menu', href: '#'}, 'Failures')));
349
+ createDom(
350
+ 'a',
351
+ { className: 'jasmine-failures-menu', href: '#' },
352
+ 'Failures'
353
+ )
354
+ )
355
+ );
255
356
  alert.appendChild(
256
- createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-failure-list'},
257
- createDom('a', {className: 'jasmine-spec-list-menu', href: '#'}, 'Spec List'),
258
- createDom('span', {}, ' | Failures ')));
357
+ createDom(
358
+ 'span',
359
+ { className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
360
+ createDom(
361
+ 'a',
362
+ { className: 'jasmine-spec-list-menu', href: '#' },
363
+ 'Spec List'
364
+ ),
365
+ createDom('span', {}, ' | Failures ')
366
+ )
367
+ );
259
368
 
260
369
  find('.jasmine-failures-menu').onclick = function() {
261
370
  setMenuModeTo('jasmine-failure-list');
371
+ return false;
262
372
  };
263
373
  find('.jasmine-spec-list-menu').onclick = function() {
264
374
  setMenuModeTo('jasmine-spec-list');
375
+ return false;
265
376
  };
266
377
 
267
378
  setMenuModeTo('jasmine-failure-list');
@@ -276,17 +387,40 @@ jasmineRequire.HtmlReporter = function(j$) {
276
387
  return this;
277
388
 
278
389
  function failureDom(result) {
279
- var failure =
280
- createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
281
- failureDescription(result, stateBuilder.currentParent),
282
- createDom('div', {className: 'jasmine-messages'})
283
- );
390
+ var failure = createDom(
391
+ 'div',
392
+ { className: 'jasmine-spec-detail jasmine-failed' },
393
+ failureDescription(result, stateBuilder.currentParent),
394
+ createDom('div', { className: 'jasmine-messages' })
395
+ );
284
396
  var messages = failure.childNodes[1];
285
397
 
286
398
  for (var i = 0; i < result.failedExpectations.length; i++) {
287
399
  var expectation = result.failedExpectations[i];
288
- messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
289
- messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
400
+ messages.appendChild(
401
+ createDom(
402
+ 'div',
403
+ { className: 'jasmine-result-message' },
404
+ expectation.message
405
+ )
406
+ );
407
+ messages.appendChild(
408
+ createDom(
409
+ 'div',
410
+ { className: 'jasmine-stack-trace' },
411
+ expectation.stack
412
+ )
413
+ );
414
+ }
415
+
416
+ if (result.failedExpectations.length === 0) {
417
+ messages.appendChild(
418
+ createDom(
419
+ 'div',
420
+ { className: 'jasmine-result-message' },
421
+ 'Spec has no expectations'
422
+ )
423
+ );
290
424
  }
291
425
 
292
426
  return failure;
@@ -300,9 +434,20 @@ jasmineRequire.HtmlReporter = function(j$) {
300
434
  continue;
301
435
  }
302
436
  if (resultNode.type === 'suite') {
303
- var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
304
- createDom('li', {className: 'jasmine-suite-detail jasmine-' + resultNode.result.status},
305
- createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
437
+ var suiteListNode = createDom(
438
+ 'ul',
439
+ { className: 'jasmine-suite', id: 'suite-' + resultNode.result.id },
440
+ createDom(
441
+ 'li',
442
+ {
443
+ className:
444
+ 'jasmine-suite-detail jasmine-' + resultNode.result.status
445
+ },
446
+ createDom(
447
+ 'a',
448
+ { href: specHref(resultNode.result) },
449
+ resultNode.result.description
450
+ )
306
451
  )
307
452
  );
308
453
 
@@ -311,22 +456,34 @@ jasmineRequire.HtmlReporter = function(j$) {
311
456
  }
312
457
  if (resultNode.type === 'spec') {
313
458
  if (domParent.getAttribute('class') !== 'jasmine-specs') {
314
- specListNode = createDom('ul', {className: 'jasmine-specs'});
459
+ specListNode = createDom('ul', { className: 'jasmine-specs' });
315
460
  domParent.appendChild(specListNode);
316
461
  }
317
462
  var specDescription = resultNode.result.description;
318
- if(noExpectations(resultNode.result)) {
463
+ if (noExpectations(resultNode.result)) {
319
464
  specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
320
465
  }
321
- if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
322
- specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
466
+ if (
467
+ resultNode.result.status === 'pending' &&
468
+ resultNode.result.pendingReason !== ''
469
+ ) {
470
+ specDescription =
471
+ specDescription +
472
+ ' PENDING WITH MESSAGE: ' +
473
+ resultNode.result.pendingReason;
323
474
  }
324
475
  specListNode.appendChild(
325
- createDom('li', {
476
+ createDom(
477
+ 'li',
478
+ {
326
479
  className: 'jasmine-' + resultNode.result.status,
327
480
  id: 'spec-' + resultNode.result.id
328
481
  },
329
- createDom('a', {href: specHref(resultNode.result)}, specDescription)
482
+ createDom(
483
+ 'a',
484
+ { href: specHref(resultNode.result) },
485
+ specDescription
486
+ )
330
487
  )
331
488
  );
332
489
  }
@@ -334,37 +491,69 @@ jasmineRequire.HtmlReporter = function(j$) {
334
491
  }
335
492
 
336
493
  function optionsMenu(config) {
337
- var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
494
+ var optionsMenuDom = createDom(
495
+ 'div',
496
+ { className: 'jasmine-run-options' },
338
497
  createDom('span', { className: 'jasmine-trigger' }, 'Options'),
339
- createDom('div', { className: 'jasmine-payload' },
340
- createDom('div', { className: 'jasmine-stop-on-failure' },
498
+ createDom(
499
+ 'div',
500
+ { className: 'jasmine-payload' },
501
+ createDom(
502
+ 'div',
503
+ { className: 'jasmine-stop-on-failure' },
341
504
  createDom('input', {
342
505
  className: 'jasmine-fail-fast',
343
506
  id: 'jasmine-fail-fast',
344
507
  type: 'checkbox'
345
508
  }),
346
- createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
347
- createDom('div', { className: 'jasmine-throw-failures' },
509
+ createDom(
510
+ 'label',
511
+ { className: 'jasmine-label', for: 'jasmine-fail-fast' },
512
+ 'stop execution on spec failure'
513
+ )
514
+ ),
515
+ createDom(
516
+ 'div',
517
+ { className: 'jasmine-throw-failures' },
348
518
  createDom('input', {
349
519
  className: 'jasmine-throw',
350
520
  id: 'jasmine-throw-failures',
351
521
  type: 'checkbox'
352
522
  }),
353
- createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
354
- createDom('div', { className: 'jasmine-random-order' },
523
+ createDom(
524
+ 'label',
525
+ { className: 'jasmine-label', for: 'jasmine-throw-failures' },
526
+ 'stop spec on expectation failure'
527
+ )
528
+ ),
529
+ createDom(
530
+ 'div',
531
+ { className: 'jasmine-random-order' },
355
532
  createDom('input', {
356
533
  className: 'jasmine-random',
357
534
  id: 'jasmine-random-order',
358
535
  type: 'checkbox'
359
536
  }),
360
- createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order')),
361
- createDom('div', { className: 'jasmine-hide-disabled' },
537
+ createDom(
538
+ 'label',
539
+ { className: 'jasmine-label', for: 'jasmine-random-order' },
540
+ 'run tests in random order'
541
+ )
542
+ ),
543
+ createDom(
544
+ 'div',
545
+ { className: 'jasmine-hide-disabled' },
362
546
  createDom('input', {
363
547
  className: 'jasmine-disabled',
364
548
  id: 'jasmine-hide-disabled',
365
549
  type: 'checkbox'
366
550
  }),
367
- createDom('label', { className: 'jasmine-label', 'for': 'jasmine-hide-disabled' }, 'hide disabled tests'))
551
+ createDom(
552
+ 'label',
553
+ { className: 'jasmine-label', for: 'jasmine-hide-disabled' },
554
+ 'hide disabled tests'
555
+ )
556
+ )
368
557
  )
369
558
  );
370
559
 
@@ -374,13 +563,17 @@ jasmineRequire.HtmlReporter = function(j$) {
374
563
  navigateWithNewParam('failFast', !config.failFast);
375
564
  };
376
565
 
377
- var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
566
+ var throwCheckbox = optionsMenuDom.querySelector(
567
+ '#jasmine-throw-failures'
568
+ );
378
569
  throwCheckbox.checked = config.oneFailurePerSpec;
379
570
  throwCheckbox.onclick = function() {
380
- navigateWithNewParam('throwFailures', !config.oneFailurePerSpec);
571
+ navigateWithNewParam('oneFailurePerSpec', !config.oneFailurePerSpec);
381
572
  };
382
573
 
383
- var randomCheckbox = optionsMenuDom.querySelector('#jasmine-random-order');
574
+ var randomCheckbox = optionsMenuDom.querySelector(
575
+ '#jasmine-random-order'
576
+ );
384
577
  randomCheckbox.checked = config.random;
385
578
  randomCheckbox.onclick = function() {
386
579
  navigateWithNewParam('random', !config.random);
@@ -398,7 +591,10 @@ jasmineRequire.HtmlReporter = function(j$) {
398
591
 
399
592
  optionsTrigger.onclick = function() {
400
593
  if (isOpen.test(optionsPayload.className)) {
401
- optionsPayload.className = optionsPayload.className.replace(isOpen, '');
594
+ optionsPayload.className = optionsPayload.className.replace(
595
+ isOpen,
596
+ ''
597
+ );
402
598
  } else {
403
599
  optionsPayload.className += ' jasmine-open';
404
600
  }
@@ -408,14 +604,24 @@ jasmineRequire.HtmlReporter = function(j$) {
408
604
  }
409
605
 
410
606
  function failureDescription(result, suite) {
411
- var wrapper = createDom('div', {className: 'jasmine-description'},
412
- createDom('a', {title: result.description, href: specHref(result)}, result.description)
607
+ var wrapper = createDom(
608
+ 'div',
609
+ { className: 'jasmine-description' },
610
+ createDom(
611
+ 'a',
612
+ { title: result.description, href: specHref(result) },
613
+ result.description
614
+ )
413
615
  );
414
616
  var suiteLink;
415
617
 
416
618
  while (suite && suite.parent) {
417
619
  wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
418
- suiteLink = createDom('a', {href: suiteHref(suite)}, suite.result.description);
620
+ suiteLink = createDom(
621
+ 'a',
622
+ { href: suiteHref(suite) },
623
+ suite.result.description
624
+ );
419
625
  wrapper.insertBefore(suiteLink, wrapper.firstChild);
420
626
 
421
627
  suite = suite.parent;
@@ -432,15 +638,23 @@ jasmineRequire.HtmlReporter = function(j$) {
432
638
  suite = suite.parent;
433
639
  }
434
640
 
435
- return addToExistingQueryString('spec', els.join(' '));
641
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
642
+ return (
643
+ (window.location.pathname || '') +
644
+ addToExistingQueryString('spec', els.join(' '))
645
+ );
436
646
  }
437
647
 
438
- function addDeprecationWarnings(result) {
648
+ function addDeprecationWarnings(result, runnableType) {
439
649
  if (result && result.deprecationWarnings) {
440
- for(var i = 0; i < result.deprecationWarnings.length; i++) {
650
+ for (var i = 0; i < result.deprecationWarnings.length; i++) {
441
651
  var warning = result.deprecationWarnings[i].message;
442
652
  if (!j$.util.arrayContains(warning)) {
443
- deprecationWarnings.push(warning);
653
+ deprecationWarnings.push({
654
+ message: warning,
655
+ runnableName: result.fullName,
656
+ runnableType: runnableType
657
+ });
444
658
  }
445
659
  }
446
660
  }
@@ -454,7 +668,7 @@ jasmineRequire.HtmlReporter = function(j$) {
454
668
  // return the reporter
455
669
  var oldReporter = find('');
456
670
 
457
- if(oldReporter) {
671
+ if (oldReporter) {
458
672
  getContainer().removeChild(oldReporter);
459
673
  }
460
674
  }
@@ -486,17 +700,25 @@ jasmineRequire.HtmlReporter = function(j$) {
486
700
  }
487
701
 
488
702
  function pluralize(singular, count) {
489
- var word = (count == 1 ? singular : singular + 's');
703
+ var word = count == 1 ? singular : singular + 's';
490
704
 
491
705
  return '' + count + ' ' + word;
492
706
  }
493
707
 
494
708
  function specHref(result) {
495
- return addToExistingQueryString('spec', result.fullName);
709
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
710
+ return (
711
+ (window.location.pathname || '') +
712
+ addToExistingQueryString('spec', result.fullName)
713
+ );
496
714
  }
497
715
 
498
716
  function seedHref(seed) {
499
- return addToExistingQueryString('seed', seed);
717
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
718
+ return (
719
+ (window.location.pathname || '') +
720
+ addToExistingQueryString('seed', seed)
721
+ );
500
722
  }
501
723
 
502
724
  function defaultQueryString(key, value) {
@@ -508,8 +730,13 @@ jasmineRequire.HtmlReporter = function(j$) {
508
730
  }
509
731
 
510
732
  function noExpectations(result) {
511
- return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
512
- result.status === 'passed';
733
+ var allExpectations =
734
+ result.failedExpectations.length + result.passedExpectations.length;
735
+
736
+ return (
737
+ allExpectations === 0 &&
738
+ (result.status === 'passed' || result.status === 'failed')
739
+ );
513
740
  }
514
741
 
515
742
  function hasActiveSpec(resultNode) {
@@ -532,7 +759,10 @@ jasmineRequire.HtmlReporter = function(j$) {
532
759
 
533
760
  jasmineRequire.HtmlSpecFilter = function() {
534
761
  function HtmlSpecFilter(options) {
535
- var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
762
+ var filterString =
763
+ options &&
764
+ options.filterString() &&
765
+ options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
536
766
  var filterPattern = new RegExp(filterString);
537
767
 
538
768
  this.matches = function(specName) {
@@ -569,9 +799,11 @@ jasmineRequire.ResultsNode = function() {
569
799
 
570
800
  jasmineRequire.QueryString = function() {
571
801
  function QueryString(options) {
572
-
573
802
  this.navigateWithNewParam = function(key, value) {
574
- options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
803
+ options.getWindowLocation().search = this.fullStringWithNewParam(
804
+ key,
805
+ value
806
+ );
575
807
  };
576
808
 
577
809
  this.fullStringWithNewParam = function(key, value) {
@@ -589,7 +821,9 @@ jasmineRequire.QueryString = function() {
589
821
  function toQueryString(paramMap) {
590
822
  var qStrPairs = [];
591
823
  for (var prop in paramMap) {
592
- qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
824
+ qStrPairs.push(
825
+ encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
826
+ );
593
827
  }
594
828
  return '?' + qStrPairs.join('&');
595
829
  }
@@ -613,7 +847,6 @@ jasmineRequire.QueryString = function() {
613
847
 
614
848
  return paramMap;
615
849
  }
616
-
617
850
  }
618
851
 
619
852
  return QueryString;