jasmine-core 3.3.0 → 3.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jasmine-core/boot.js +6 -3
- data/lib/jasmine-core/boot/boot.js +5 -2
- data/lib/jasmine-core/example/src/Player.js +1 -1
- data/lib/jasmine-core/example/src/Song.js +1 -1
- data/lib/jasmine-core/jasmine-html.js +313 -101
- data/lib/jasmine-core/jasmine.css +65 -3
- data/lib/jasmine-core/jasmine.js +3514 -1013
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +4 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0633e3d3e468f779220b229062eae61754bc886788981cadb4ac571ca61f09e
|
4
|
+
data.tar.gz: c738ae0489e9b35212f228b0c81674ef19544338b39ca0fa86f09977d04c61ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce627b117c79117d1c83b17411291022310e5d15eeec55a99eb90663397a21657d64361c7a8384bf6a3909c7bef5961d25344f0d66467be1fa267ad74aa1421e
|
7
|
+
data.tar.gz: 492b3ce3d974d9ce732fbf799e2b6c8eee5c98466b5c9656d910e6df5f4ad2a225b206a9d14b400abc8749a6ebaffaf6f4f77b80d9df9e96f211bf1b14bfb6e3
|
data/lib/jasmine-core/boot.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
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
|
-
|
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(
|
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
|
-
|
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(
|
43
|
+
extend(global, jasmineInterface);
|
41
44
|
|
42
45
|
/**
|
43
46
|
* ## Runner Parameters
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
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$);
|
@@ -28,12 +30,6 @@ jasmineRequire.html = function(j$) {
|
|
28
30
|
};
|
29
31
|
|
30
32
|
jasmineRequire.HtmlReporter = function(j$) {
|
31
|
-
|
32
|
-
var noopTimer = {
|
33
|
-
start: function() {},
|
34
|
-
elapsed: function() { return 0; }
|
35
|
-
};
|
36
|
-
|
37
33
|
function ResultsStateBuilder() {
|
38
34
|
this.topResults = new j$.ResultsNode({}, '', null);
|
39
35
|
this.currentParent = this.topResults;
|
@@ -58,8 +54,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
58
54
|
}
|
59
55
|
};
|
60
56
|
|
61
|
-
ResultsStateBuilder.prototype.specStarted = function(result) {
|
62
|
-
};
|
57
|
+
ResultsStateBuilder.prototype.specStarted = function(result) {};
|
63
58
|
|
64
59
|
ResultsStateBuilder.prototype.specDone = function(result) {
|
65
60
|
this.currentParent.addChild(result, 'spec');
|
@@ -77,32 +72,42 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
77
72
|
}
|
78
73
|
};
|
79
74
|
|
80
|
-
|
81
|
-
|
82
75
|
function HtmlReporter(options) {
|
83
|
-
var config = function() {
|
76
|
+
var config = function() {
|
77
|
+
return (options.env && options.env.configuration()) || {};
|
78
|
+
},
|
84
79
|
getContainer = options.getContainer,
|
85
80
|
createElement = options.createElement,
|
86
81
|
createTextNode = options.createTextNode,
|
87
82
|
navigateWithNewParam = options.navigateWithNewParam || function() {},
|
88
|
-
addToExistingQueryString =
|
83
|
+
addToExistingQueryString =
|
84
|
+
options.addToExistingQueryString || defaultQueryString,
|
89
85
|
filterSpecs = options.filterSpecs,
|
90
|
-
timer = options.timer || noopTimer,
|
91
86
|
htmlReporterMain,
|
92
87
|
symbols,
|
93
88
|
deprecationWarnings = [];
|
94
89
|
|
95
90
|
this.initialize = function() {
|
96
91
|
clearPrior();
|
97
|
-
htmlReporterMain = createDom(
|
98
|
-
|
99
|
-
|
100
|
-
|
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)
|
101
104
|
),
|
102
|
-
createDom('ul', {className: 'jasmine-symbol-summary'}),
|
103
|
-
createDom('div', {className: 'jasmine-alert'}),
|
104
|
-
createDom(
|
105
|
-
|
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' })
|
106
111
|
)
|
107
112
|
);
|
108
113
|
getContainer().appendChild(htmlReporterMain);
|
@@ -111,10 +116,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
111
116
|
var totalSpecsDefined;
|
112
117
|
this.jasmineStarted = function(options) {
|
113
118
|
totalSpecsDefined = options.totalSpecsDefined || 0;
|
114
|
-
timer.start();
|
115
119
|
};
|
116
120
|
|
117
|
-
var summary = createDom('div', {className: 'jasmine-summary'});
|
121
|
+
var summary = createDom('div', { className: 'jasmine-summary' });
|
118
122
|
|
119
123
|
var stateBuilder = new ResultsStateBuilder();
|
120
124
|
|
@@ -128,7 +132,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
128
132
|
if (result.status === 'failed') {
|
129
133
|
failures.push(failureDom(result));
|
130
134
|
}
|
131
|
-
addDeprecationWarnings(result);
|
135
|
+
addDeprecationWarnings(result, 'suite');
|
132
136
|
};
|
133
137
|
|
134
138
|
this.specStarted = function(result) {
|
@@ -139,35 +143,45 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
139
143
|
this.specDone = function(result) {
|
140
144
|
stateBuilder.specDone(result);
|
141
145
|
|
142
|
-
if(noExpectations(result)
|
143
|
-
|
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
|
+
}
|
144
153
|
}
|
145
154
|
|
146
|
-
if (!symbols){
|
155
|
+
if (!symbols) {
|
147
156
|
symbols = find('.jasmine-symbol-summary');
|
148
157
|
}
|
149
158
|
|
150
|
-
symbols.appendChild(
|
159
|
+
symbols.appendChild(
|
160
|
+
createDom('li', {
|
151
161
|
className: this.displaySpecInCorrectFormat(result),
|
152
162
|
id: 'spec_' + result.id,
|
153
163
|
title: result.fullName
|
154
|
-
}
|
155
|
-
)
|
164
|
+
})
|
165
|
+
);
|
156
166
|
|
157
167
|
if (result.status === 'failed') {
|
158
168
|
failures.push(failureDom(result));
|
159
169
|
}
|
160
170
|
|
161
|
-
addDeprecationWarnings(result);
|
171
|
+
addDeprecationWarnings(result, 'spec');
|
162
172
|
};
|
163
173
|
|
164
174
|
this.displaySpecInCorrectFormat = function(result) {
|
165
|
-
return noExpectations(result)
|
175
|
+
return noExpectations(result) && result.status === 'passed'
|
176
|
+
? 'jasmine-empty'
|
177
|
+
: this.resultStatus(result.status);
|
166
178
|
};
|
167
179
|
|
168
180
|
this.resultStatus = function(status) {
|
169
|
-
if(status === 'excluded') {
|
170
|
-
return config().hideDisabled
|
181
|
+
if (status === 'excluded') {
|
182
|
+
return config().hideDisabled
|
183
|
+
? 'jasmine-excluded-no-display'
|
184
|
+
: 'jasmine-excluded';
|
171
185
|
}
|
172
186
|
return 'jasmine-' + status;
|
173
187
|
};
|
@@ -177,16 +191,33 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
177
191
|
var alert = find('.jasmine-alert');
|
178
192
|
var order = doneResult && doneResult.order;
|
179
193
|
var i;
|
180
|
-
alert.appendChild(
|
194
|
+
alert.appendChild(
|
195
|
+
createDom(
|
196
|
+
'span',
|
197
|
+
{ className: 'jasmine-duration' },
|
198
|
+
'finished in ' + doneResult.totalTime / 1000 + 's'
|
199
|
+
)
|
200
|
+
);
|
181
201
|
|
182
202
|
banner.appendChild(optionsMenu(config()));
|
183
203
|
|
184
204
|
if (stateBuilder.specsExecuted < totalSpecsDefined) {
|
185
|
-
var skippedMessage =
|
205
|
+
var skippedMessage =
|
206
|
+
'Ran ' +
|
207
|
+
stateBuilder.specsExecuted +
|
208
|
+
' of ' +
|
209
|
+
totalSpecsDefined +
|
210
|
+
' specs - run all';
|
186
211
|
var skippedLink = addToExistingQueryString('spec', '');
|
187
212
|
alert.appendChild(
|
188
|
-
createDom(
|
189
|
-
|
213
|
+
createDom(
|
214
|
+
'span',
|
215
|
+
{ className: 'jasmine-bar jasmine-skipped' },
|
216
|
+
createDom(
|
217
|
+
'a',
|
218
|
+
{ href: skippedLink, title: 'Run all specs' },
|
219
|
+
skippedMessage
|
220
|
+
)
|
190
221
|
)
|
191
222
|
);
|
192
223
|
}
|
@@ -196,34 +227,66 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
196
227
|
var failed = stateBuilder.failureCount + globalFailures.length > 0;
|
197
228
|
|
198
229
|
if (totalSpecsDefined > 0 || failed) {
|
199
|
-
statusBarMessage +=
|
200
|
-
|
230
|
+
statusBarMessage +=
|
231
|
+
pluralize('spec', stateBuilder.specsExecuted) +
|
232
|
+
', ' +
|
233
|
+
pluralize('failure', stateBuilder.failureCount);
|
234
|
+
if (stateBuilder.pendingSpecCount) {
|
235
|
+
statusBarMessage +=
|
236
|
+
', ' + pluralize('pending spec', stateBuilder.pendingSpecCount);
|
237
|
+
}
|
201
238
|
}
|
202
239
|
|
203
240
|
if (doneResult.overallStatus === 'passed') {
|
204
241
|
statusBarClassName += ' jasmine-passed ';
|
205
242
|
} else if (doneResult.overallStatus === 'incomplete') {
|
206
243
|
statusBarClassName += ' jasmine-incomplete ';
|
207
|
-
statusBarMessage =
|
244
|
+
statusBarMessage =
|
245
|
+
'Incomplete: ' +
|
246
|
+
doneResult.incompleteReason +
|
247
|
+
', ' +
|
248
|
+
statusBarMessage;
|
208
249
|
} else {
|
209
250
|
statusBarClassName += ' jasmine-failed ';
|
210
251
|
}
|
211
252
|
|
212
253
|
var seedBar;
|
213
254
|
if (order && order.random) {
|
214
|
-
seedBar = createDom(
|
255
|
+
seedBar = createDom(
|
256
|
+
'span',
|
257
|
+
{ className: 'jasmine-seed-bar' },
|
215
258
|
', randomized with seed ',
|
216
|
-
createDom(
|
259
|
+
createDom(
|
260
|
+
'a',
|
261
|
+
{
|
262
|
+
title: 'randomized with seed ' + order.seed,
|
263
|
+
href: seedHref(order.seed)
|
264
|
+
},
|
265
|
+
order.seed
|
266
|
+
)
|
217
267
|
);
|
218
268
|
}
|
219
269
|
|
220
|
-
alert.appendChild(
|
270
|
+
alert.appendChild(
|
271
|
+
createDom(
|
272
|
+
'span',
|
273
|
+
{ className: statusBarClassName },
|
274
|
+
statusBarMessage,
|
275
|
+
seedBar
|
276
|
+
)
|
277
|
+
);
|
221
278
|
|
222
279
|
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
223
280
|
var afterAllMessagePrefix = 'AfterAll ';
|
224
281
|
|
225
|
-
for(i = 0; i < globalFailures.length; i++) {
|
226
|
-
alert.appendChild(
|
282
|
+
for (i = 0; i < globalFailures.length; i++) {
|
283
|
+
alert.appendChild(
|
284
|
+
createDom(
|
285
|
+
'span',
|
286
|
+
{ className: errorBarClassName },
|
287
|
+
globalFailureMessage(globalFailures[i])
|
288
|
+
)
|
289
|
+
);
|
227
290
|
}
|
228
291
|
|
229
292
|
function globalFailureMessage(failure) {
|
@@ -231,7 +294,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
231
294
|
var prefix = 'Error during loading: ' + failure.message;
|
232
295
|
|
233
296
|
if (failure.filename) {
|
234
|
-
return
|
297
|
+
return (
|
298
|
+
prefix + ' in ' + failure.filename + ' line ' + failure.lineno
|
299
|
+
);
|
235
300
|
} else {
|
236
301
|
return prefix;
|
237
302
|
}
|
@@ -242,10 +307,29 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
242
307
|
|
243
308
|
addDeprecationWarnings(doneResult);
|
244
309
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
310
|
+
for (i = 0; i < deprecationWarnings.length; i++) {
|
311
|
+
var context;
|
312
|
+
|
313
|
+
switch (deprecationWarnings[i].runnableType) {
|
314
|
+
case 'spec':
|
315
|
+
context = '(in spec: ' + deprecationWarnings[i].runnableName + ')';
|
316
|
+
break;
|
317
|
+
case 'suite':
|
318
|
+
context = '(in suite: ' + deprecationWarnings[i].runnableName + ')';
|
319
|
+
break;
|
320
|
+
default:
|
321
|
+
context = '';
|
322
|
+
}
|
323
|
+
|
324
|
+
alert.appendChild(
|
325
|
+
createDom(
|
326
|
+
'span',
|
327
|
+
{ className: 'jasmine-bar jasmine-warning' },
|
328
|
+
'DEPRECATION: ' + deprecationWarnings[i].message,
|
329
|
+
createDom('br'),
|
330
|
+
context
|
331
|
+
)
|
332
|
+
);
|
249
333
|
}
|
250
334
|
|
251
335
|
var results = find('.jasmine-results');
|
@@ -255,19 +339,37 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
255
339
|
|
256
340
|
if (failures.length) {
|
257
341
|
alert.appendChild(
|
258
|
-
createDom(
|
342
|
+
createDom(
|
343
|
+
'span',
|
344
|
+
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
259
345
|
createDom('span', {}, 'Spec List | '),
|
260
|
-
createDom(
|
346
|
+
createDom(
|
347
|
+
'a',
|
348
|
+
{ className: 'jasmine-failures-menu', href: '#' },
|
349
|
+
'Failures'
|
350
|
+
)
|
351
|
+
)
|
352
|
+
);
|
261
353
|
alert.appendChild(
|
262
|
-
createDom(
|
263
|
-
|
264
|
-
|
354
|
+
createDom(
|
355
|
+
'span',
|
356
|
+
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
357
|
+
createDom(
|
358
|
+
'a',
|
359
|
+
{ className: 'jasmine-spec-list-menu', href: '#' },
|
360
|
+
'Spec List'
|
361
|
+
),
|
362
|
+
createDom('span', {}, ' | Failures ')
|
363
|
+
)
|
364
|
+
);
|
265
365
|
|
266
366
|
find('.jasmine-failures-menu').onclick = function() {
|
267
367
|
setMenuModeTo('jasmine-failure-list');
|
368
|
+
return false;
|
268
369
|
};
|
269
370
|
find('.jasmine-spec-list-menu').onclick = function() {
|
270
371
|
setMenuModeTo('jasmine-spec-list');
|
372
|
+
return false;
|
271
373
|
};
|
272
374
|
|
273
375
|
setMenuModeTo('jasmine-failure-list');
|
@@ -282,17 +384,40 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
282
384
|
return this;
|
283
385
|
|
284
386
|
function failureDom(result) {
|
285
|
-
var failure =
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
)
|
387
|
+
var failure = createDom(
|
388
|
+
'div',
|
389
|
+
{ className: 'jasmine-spec-detail jasmine-failed' },
|
390
|
+
failureDescription(result, stateBuilder.currentParent),
|
391
|
+
createDom('div', { className: 'jasmine-messages' })
|
392
|
+
);
|
290
393
|
var messages = failure.childNodes[1];
|
291
394
|
|
292
395
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
293
396
|
var expectation = result.failedExpectations[i];
|
294
|
-
messages.appendChild(
|
295
|
-
|
397
|
+
messages.appendChild(
|
398
|
+
createDom(
|
399
|
+
'div',
|
400
|
+
{ className: 'jasmine-result-message' },
|
401
|
+
expectation.message
|
402
|
+
)
|
403
|
+
);
|
404
|
+
messages.appendChild(
|
405
|
+
createDom(
|
406
|
+
'div',
|
407
|
+
{ className: 'jasmine-stack-trace' },
|
408
|
+
expectation.stack
|
409
|
+
)
|
410
|
+
);
|
411
|
+
}
|
412
|
+
|
413
|
+
if (result.failedExpectations.length === 0) {
|
414
|
+
messages.appendChild(
|
415
|
+
createDom(
|
416
|
+
'div',
|
417
|
+
{ className: 'jasmine-result-message' },
|
418
|
+
'Spec has no expectations'
|
419
|
+
)
|
420
|
+
);
|
296
421
|
}
|
297
422
|
|
298
423
|
return failure;
|
@@ -306,9 +431,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
306
431
|
continue;
|
307
432
|
}
|
308
433
|
if (resultNode.type === 'suite') {
|
309
|
-
var suiteListNode = createDom(
|
310
|
-
|
311
|
-
|
434
|
+
var suiteListNode = createDom(
|
435
|
+
'ul',
|
436
|
+
{ className: 'jasmine-suite', id: 'suite-' + resultNode.result.id },
|
437
|
+
createDom(
|
438
|
+
'li',
|
439
|
+
{
|
440
|
+
className:
|
441
|
+
'jasmine-suite-detail jasmine-' + resultNode.result.status
|
442
|
+
},
|
443
|
+
createDom(
|
444
|
+
'a',
|
445
|
+
{ href: specHref(resultNode.result) },
|
446
|
+
resultNode.result.description
|
447
|
+
)
|
312
448
|
)
|
313
449
|
);
|
314
450
|
|
@@ -317,22 +453,34 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
317
453
|
}
|
318
454
|
if (resultNode.type === 'spec') {
|
319
455
|
if (domParent.getAttribute('class') !== 'jasmine-specs') {
|
320
|
-
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
456
|
+
specListNode = createDom('ul', { className: 'jasmine-specs' });
|
321
457
|
domParent.appendChild(specListNode);
|
322
458
|
}
|
323
459
|
var specDescription = resultNode.result.description;
|
324
|
-
if(noExpectations(resultNode.result)) {
|
460
|
+
if (noExpectations(resultNode.result)) {
|
325
461
|
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
326
462
|
}
|
327
|
-
if(
|
328
|
-
|
463
|
+
if (
|
464
|
+
resultNode.result.status === 'pending' &&
|
465
|
+
resultNode.result.pendingReason !== ''
|
466
|
+
) {
|
467
|
+
specDescription =
|
468
|
+
specDescription +
|
469
|
+
' PENDING WITH MESSAGE: ' +
|
470
|
+
resultNode.result.pendingReason;
|
329
471
|
}
|
330
472
|
specListNode.appendChild(
|
331
|
-
createDom(
|
473
|
+
createDom(
|
474
|
+
'li',
|
475
|
+
{
|
332
476
|
className: 'jasmine-' + resultNode.result.status,
|
333
477
|
id: 'spec-' + resultNode.result.id
|
334
478
|
},
|
335
|
-
createDom(
|
479
|
+
createDom(
|
480
|
+
'a',
|
481
|
+
{ href: specHref(resultNode.result) },
|
482
|
+
specDescription
|
483
|
+
)
|
336
484
|
)
|
337
485
|
);
|
338
486
|
}
|
@@ -340,37 +488,69 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
340
488
|
}
|
341
489
|
|
342
490
|
function optionsMenu(config) {
|
343
|
-
var optionsMenuDom = createDom(
|
491
|
+
var optionsMenuDom = createDom(
|
492
|
+
'div',
|
493
|
+
{ className: 'jasmine-run-options' },
|
344
494
|
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
345
|
-
createDom(
|
346
|
-
|
495
|
+
createDom(
|
496
|
+
'div',
|
497
|
+
{ className: 'jasmine-payload' },
|
498
|
+
createDom(
|
499
|
+
'div',
|
500
|
+
{ className: 'jasmine-stop-on-failure' },
|
347
501
|
createDom('input', {
|
348
502
|
className: 'jasmine-fail-fast',
|
349
503
|
id: 'jasmine-fail-fast',
|
350
504
|
type: 'checkbox'
|
351
505
|
}),
|
352
|
-
createDom(
|
353
|
-
|
506
|
+
createDom(
|
507
|
+
'label',
|
508
|
+
{ className: 'jasmine-label', for: 'jasmine-fail-fast' },
|
509
|
+
'stop execution on spec failure'
|
510
|
+
)
|
511
|
+
),
|
512
|
+
createDom(
|
513
|
+
'div',
|
514
|
+
{ className: 'jasmine-throw-failures' },
|
354
515
|
createDom('input', {
|
355
516
|
className: 'jasmine-throw',
|
356
517
|
id: 'jasmine-throw-failures',
|
357
518
|
type: 'checkbox'
|
358
519
|
}),
|
359
|
-
createDom(
|
360
|
-
|
520
|
+
createDom(
|
521
|
+
'label',
|
522
|
+
{ className: 'jasmine-label', for: 'jasmine-throw-failures' },
|
523
|
+
'stop spec on expectation failure'
|
524
|
+
)
|
525
|
+
),
|
526
|
+
createDom(
|
527
|
+
'div',
|
528
|
+
{ className: 'jasmine-random-order' },
|
361
529
|
createDom('input', {
|
362
530
|
className: 'jasmine-random',
|
363
531
|
id: 'jasmine-random-order',
|
364
532
|
type: 'checkbox'
|
365
533
|
}),
|
366
|
-
createDom(
|
367
|
-
|
534
|
+
createDom(
|
535
|
+
'label',
|
536
|
+
{ className: 'jasmine-label', for: 'jasmine-random-order' },
|
537
|
+
'run tests in random order'
|
538
|
+
)
|
539
|
+
),
|
540
|
+
createDom(
|
541
|
+
'div',
|
542
|
+
{ className: 'jasmine-hide-disabled' },
|
368
543
|
createDom('input', {
|
369
544
|
className: 'jasmine-disabled',
|
370
545
|
id: 'jasmine-hide-disabled',
|
371
546
|
type: 'checkbox'
|
372
547
|
}),
|
373
|
-
createDom(
|
548
|
+
createDom(
|
549
|
+
'label',
|
550
|
+
{ className: 'jasmine-label', for: 'jasmine-hide-disabled' },
|
551
|
+
'hide disabled tests'
|
552
|
+
)
|
553
|
+
)
|
374
554
|
)
|
375
555
|
);
|
376
556
|
|
@@ -380,13 +560,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
380
560
|
navigateWithNewParam('failFast', !config.failFast);
|
381
561
|
};
|
382
562
|
|
383
|
-
var throwCheckbox = optionsMenuDom.querySelector(
|
563
|
+
var throwCheckbox = optionsMenuDom.querySelector(
|
564
|
+
'#jasmine-throw-failures'
|
565
|
+
);
|
384
566
|
throwCheckbox.checked = config.oneFailurePerSpec;
|
385
567
|
throwCheckbox.onclick = function() {
|
386
568
|
navigateWithNewParam('throwFailures', !config.oneFailurePerSpec);
|
387
569
|
};
|
388
570
|
|
389
|
-
var randomCheckbox = optionsMenuDom.querySelector(
|
571
|
+
var randomCheckbox = optionsMenuDom.querySelector(
|
572
|
+
'#jasmine-random-order'
|
573
|
+
);
|
390
574
|
randomCheckbox.checked = config.random;
|
391
575
|
randomCheckbox.onclick = function() {
|
392
576
|
navigateWithNewParam('random', !config.random);
|
@@ -404,7 +588,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
404
588
|
|
405
589
|
optionsTrigger.onclick = function() {
|
406
590
|
if (isOpen.test(optionsPayload.className)) {
|
407
|
-
optionsPayload.className = optionsPayload.className.replace(
|
591
|
+
optionsPayload.className = optionsPayload.className.replace(
|
592
|
+
isOpen,
|
593
|
+
''
|
594
|
+
);
|
408
595
|
} else {
|
409
596
|
optionsPayload.className += ' jasmine-open';
|
410
597
|
}
|
@@ -414,14 +601,24 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
414
601
|
}
|
415
602
|
|
416
603
|
function failureDescription(result, suite) {
|
417
|
-
var wrapper = createDom(
|
418
|
-
|
604
|
+
var wrapper = createDom(
|
605
|
+
'div',
|
606
|
+
{ className: 'jasmine-description' },
|
607
|
+
createDom(
|
608
|
+
'a',
|
609
|
+
{ title: result.description, href: specHref(result) },
|
610
|
+
result.description
|
611
|
+
)
|
419
612
|
);
|
420
613
|
var suiteLink;
|
421
614
|
|
422
615
|
while (suite && suite.parent) {
|
423
616
|
wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
|
424
|
-
suiteLink = createDom(
|
617
|
+
suiteLink = createDom(
|
618
|
+
'a',
|
619
|
+
{ href: suiteHref(suite) },
|
620
|
+
suite.result.description
|
621
|
+
);
|
425
622
|
wrapper.insertBefore(suiteLink, wrapper.firstChild);
|
426
623
|
|
427
624
|
suite = suite.parent;
|
@@ -441,12 +638,16 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
441
638
|
return addToExistingQueryString('spec', els.join(' '));
|
442
639
|
}
|
443
640
|
|
444
|
-
function addDeprecationWarnings(result) {
|
641
|
+
function addDeprecationWarnings(result, runnableType) {
|
445
642
|
if (result && result.deprecationWarnings) {
|
446
|
-
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
643
|
+
for (var i = 0; i < result.deprecationWarnings.length; i++) {
|
447
644
|
var warning = result.deprecationWarnings[i].message;
|
448
645
|
if (!j$.util.arrayContains(warning)) {
|
449
|
-
deprecationWarnings.push(
|
646
|
+
deprecationWarnings.push({
|
647
|
+
message: warning,
|
648
|
+
runnableName: result.fullName,
|
649
|
+
runnableType: runnableType
|
650
|
+
});
|
450
651
|
}
|
451
652
|
}
|
452
653
|
}
|
@@ -460,7 +661,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
460
661
|
// return the reporter
|
461
662
|
var oldReporter = find('');
|
462
663
|
|
463
|
-
if(oldReporter) {
|
664
|
+
if (oldReporter) {
|
464
665
|
getContainer().removeChild(oldReporter);
|
465
666
|
}
|
466
667
|
}
|
@@ -492,7 +693,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
492
693
|
}
|
493
694
|
|
494
695
|
function pluralize(singular, count) {
|
495
|
-
var word =
|
696
|
+
var word = count == 1 ? singular : singular + 's';
|
496
697
|
|
497
698
|
return '' + count + ' ' + word;
|
498
699
|
}
|
@@ -514,8 +715,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
514
715
|
}
|
515
716
|
|
516
717
|
function noExpectations(result) {
|
517
|
-
|
518
|
-
result.
|
718
|
+
var allExpectations =
|
719
|
+
result.failedExpectations.length + result.passedExpectations.length;
|
720
|
+
|
721
|
+
return (
|
722
|
+
allExpectations === 0 &&
|
723
|
+
(result.status === 'passed' || result.status === 'failed')
|
724
|
+
);
|
519
725
|
}
|
520
726
|
|
521
727
|
function hasActiveSpec(resultNode) {
|
@@ -538,7 +744,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
538
744
|
|
539
745
|
jasmineRequire.HtmlSpecFilter = function() {
|
540
746
|
function HtmlSpecFilter(options) {
|
541
|
-
var filterString =
|
747
|
+
var filterString =
|
748
|
+
options &&
|
749
|
+
options.filterString() &&
|
750
|
+
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
542
751
|
var filterPattern = new RegExp(filterString);
|
543
752
|
|
544
753
|
this.matches = function(specName) {
|
@@ -575,9 +784,11 @@ jasmineRequire.ResultsNode = function() {
|
|
575
784
|
|
576
785
|
jasmineRequire.QueryString = function() {
|
577
786
|
function QueryString(options) {
|
578
|
-
|
579
787
|
this.navigateWithNewParam = function(key, value) {
|
580
|
-
options.getWindowLocation().search = this.fullStringWithNewParam(
|
788
|
+
options.getWindowLocation().search = this.fullStringWithNewParam(
|
789
|
+
key,
|
790
|
+
value
|
791
|
+
);
|
581
792
|
};
|
582
793
|
|
583
794
|
this.fullStringWithNewParam = function(key, value) {
|
@@ -595,7 +806,9 @@ jasmineRequire.QueryString = function() {
|
|
595
806
|
function toQueryString(paramMap) {
|
596
807
|
var qStrPairs = [];
|
597
808
|
for (var prop in paramMap) {
|
598
|
-
qStrPairs.push(
|
809
|
+
qStrPairs.push(
|
810
|
+
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
|
811
|
+
);
|
599
812
|
}
|
600
813
|
return '?' + qStrPairs.join('&');
|
601
814
|
}
|
@@ -619,7 +832,6 @@ jasmineRequire.QueryString = function() {
|
|
619
832
|
|
620
833
|
return paramMap;
|
621
834
|
}
|
622
|
-
|
623
835
|
}
|
624
836
|
|
625
837
|
return QueryString;
|