jasmine-core 3.2.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jasmine-core/boot.js +16 -14
- data/lib/jasmine-core/boot/boot.js +15 -13
- 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 +302 -107
- data/lib/jasmine-core/jasmine.css +75 -7
- data/lib/jasmine-core/jasmine.js +3337 -989
- 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: 6f216c9ede11495c789c3403db642a8ff9fc5aee6d25ad22356d80acbc528059
|
4
|
+
data.tar.gz: 9e2cc50ac86cfd8672e138165552c36d3a31d237639b3f8b069bcd0d8321b133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9be17fe38e5345998145c7ce83527a847f16a2710b163ab4231d3f6fc7ce092cb41e25375905391484f1357b8b4e00e7cbc3a2ae3cbefeaa841ca1bcfab57d
|
7
|
+
data.tar.gz: ea5cf016d142717bdf613ea3b66597ee2a7fbc28965427ee3257abc40ba1901ef23af788d681e0eaf208ec0ff7210c19c888571515ed1b8f5f06834ed8151539
|
data/lib/jasmine-core/boot.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2020 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
|
@@ -73,24 +76,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
73
76
|
|
74
77
|
var filterSpecs = !!queryString.getParam("spec");
|
75
78
|
|
76
|
-
var
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
var hideDisabled = queryString.getParam("hideDisabled");
|
83
|
-
env.hideDisabled(hideDisabled);
|
79
|
+
var config = {
|
80
|
+
failFast: queryString.getParam("failFast"),
|
81
|
+
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
|
82
|
+
hideDisabled: queryString.getParam("hideDisabled")
|
83
|
+
};
|
84
84
|
|
85
85
|
var random = queryString.getParam("random");
|
86
86
|
|
87
87
|
if (random !== undefined && random !== "") {
|
88
|
-
|
88
|
+
config.random = random;
|
89
89
|
}
|
90
90
|
|
91
91
|
var seed = queryString.getParam("seed");
|
92
92
|
if (seed) {
|
93
|
-
|
93
|
+
config.seed = seed;
|
94
94
|
}
|
95
95
|
|
96
96
|
/**
|
@@ -121,10 +121,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
121
121
|
filterString: function() { return queryString.getParam("spec"); }
|
122
122
|
});
|
123
123
|
|
124
|
-
|
124
|
+
config.specFilter = function(spec) {
|
125
125
|
return specFilter.matches(spec.getFullName());
|
126
126
|
};
|
127
127
|
|
128
|
+
env.configure(config);
|
129
|
+
|
128
130
|
/**
|
129
131
|
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
|
130
132
|
*/
|
@@ -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
|
@@ -51,24 +54,21 @@
|
|
51
54
|
|
52
55
|
var filterSpecs = !!queryString.getParam("spec");
|
53
56
|
|
54
|
-
var
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
var hideDisabled = queryString.getParam("hideDisabled");
|
61
|
-
env.hideDisabled(hideDisabled);
|
57
|
+
var config = {
|
58
|
+
failFast: queryString.getParam("failFast"),
|
59
|
+
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
|
60
|
+
hideDisabled: queryString.getParam("hideDisabled")
|
61
|
+
};
|
62
62
|
|
63
63
|
var random = queryString.getParam("random");
|
64
64
|
|
65
65
|
if (random !== undefined && random !== "") {
|
66
|
-
|
66
|
+
config.random = random;
|
67
67
|
}
|
68
68
|
|
69
69
|
var seed = queryString.getParam("seed");
|
70
70
|
if (seed) {
|
71
|
-
|
71
|
+
config.seed = seed;
|
72
72
|
}
|
73
73
|
|
74
74
|
/**
|
@@ -99,10 +99,12 @@
|
|
99
99
|
filterString: function() { return queryString.getParam("spec"); }
|
100
100
|
});
|
101
101
|
|
102
|
-
|
102
|
+
config.specFilter = function(spec) {
|
103
103
|
return specFilter.matches(spec.getFullName());
|
104
104
|
};
|
105
105
|
|
106
|
+
env.configure(config);
|
107
|
+
|
106
108
|
/**
|
107
109
|
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
|
108
110
|
*/
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2020 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
|
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
|
|
@@ -139,20 +143,26 @@ 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));
|
@@ -162,14 +172,18 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
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
|
171
|
-
|
172
|
-
|
181
|
+
if (status === 'excluded') {
|
182
|
+
return config().hideDisabled
|
183
|
+
? 'jasmine-excluded-no-display'
|
184
|
+
: 'jasmine-excluded';
|
185
|
+
}
|
186
|
+
return 'jasmine-' + status;
|
173
187
|
};
|
174
188
|
|
175
189
|
this.jasmineDone = function(doneResult) {
|
@@ -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
|
-
banner.appendChild(optionsMenu(
|
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
|
}
|
@@ -243,9 +308,15 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
243
308
|
addDeprecationWarnings(doneResult);
|
244
309
|
|
245
310
|
var warningBarClassName = 'jasmine-bar jasmine-warning';
|
246
|
-
for(i = 0; i < deprecationWarnings.length; i++) {
|
311
|
+
for (i = 0; i < deprecationWarnings.length; i++) {
|
247
312
|
var warning = deprecationWarnings[i];
|
248
|
-
alert.appendChild(
|
313
|
+
alert.appendChild(
|
314
|
+
createDom(
|
315
|
+
'span',
|
316
|
+
{ className: warningBarClassName },
|
317
|
+
'DEPRECATION: ' + warning
|
318
|
+
)
|
319
|
+
);
|
249
320
|
}
|
250
321
|
|
251
322
|
var results = find('.jasmine-results');
|
@@ -255,19 +326,37 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
255
326
|
|
256
327
|
if (failures.length) {
|
257
328
|
alert.appendChild(
|
258
|
-
createDom(
|
329
|
+
createDom(
|
330
|
+
'span',
|
331
|
+
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
259
332
|
createDom('span', {}, 'Spec List | '),
|
260
|
-
createDom(
|
333
|
+
createDom(
|
334
|
+
'a',
|
335
|
+
{ className: 'jasmine-failures-menu', href: '#' },
|
336
|
+
'Failures'
|
337
|
+
)
|
338
|
+
)
|
339
|
+
);
|
261
340
|
alert.appendChild(
|
262
|
-
createDom(
|
263
|
-
|
264
|
-
|
341
|
+
createDom(
|
342
|
+
'span',
|
343
|
+
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
344
|
+
createDom(
|
345
|
+
'a',
|
346
|
+
{ className: 'jasmine-spec-list-menu', href: '#' },
|
347
|
+
'Spec List'
|
348
|
+
),
|
349
|
+
createDom('span', {}, ' | Failures ')
|
350
|
+
)
|
351
|
+
);
|
265
352
|
|
266
353
|
find('.jasmine-failures-menu').onclick = function() {
|
267
354
|
setMenuModeTo('jasmine-failure-list');
|
355
|
+
return false;
|
268
356
|
};
|
269
357
|
find('.jasmine-spec-list-menu').onclick = function() {
|
270
358
|
setMenuModeTo('jasmine-spec-list');
|
359
|
+
return false;
|
271
360
|
};
|
272
361
|
|
273
362
|
setMenuModeTo('jasmine-failure-list');
|
@@ -282,17 +371,40 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
282
371
|
return this;
|
283
372
|
|
284
373
|
function failureDom(result) {
|
285
|
-
var failure =
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
)
|
374
|
+
var failure = createDom(
|
375
|
+
'div',
|
376
|
+
{ className: 'jasmine-spec-detail jasmine-failed' },
|
377
|
+
failureDescription(result, stateBuilder.currentParent),
|
378
|
+
createDom('div', { className: 'jasmine-messages' })
|
379
|
+
);
|
290
380
|
var messages = failure.childNodes[1];
|
291
381
|
|
292
382
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
293
383
|
var expectation = result.failedExpectations[i];
|
294
|
-
messages.appendChild(
|
295
|
-
|
384
|
+
messages.appendChild(
|
385
|
+
createDom(
|
386
|
+
'div',
|
387
|
+
{ className: 'jasmine-result-message' },
|
388
|
+
expectation.message
|
389
|
+
)
|
390
|
+
);
|
391
|
+
messages.appendChild(
|
392
|
+
createDom(
|
393
|
+
'div',
|
394
|
+
{ className: 'jasmine-stack-trace' },
|
395
|
+
expectation.stack
|
396
|
+
)
|
397
|
+
);
|
398
|
+
}
|
399
|
+
|
400
|
+
if (result.failedExpectations.length === 0) {
|
401
|
+
messages.appendChild(
|
402
|
+
createDom(
|
403
|
+
'div',
|
404
|
+
{ className: 'jasmine-result-message' },
|
405
|
+
'Spec has no expectations'
|
406
|
+
)
|
407
|
+
);
|
296
408
|
}
|
297
409
|
|
298
410
|
return failure;
|
@@ -306,9 +418,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
306
418
|
continue;
|
307
419
|
}
|
308
420
|
if (resultNode.type === 'suite') {
|
309
|
-
var suiteListNode = createDom(
|
310
|
-
|
311
|
-
|
421
|
+
var suiteListNode = createDom(
|
422
|
+
'ul',
|
423
|
+
{ className: 'jasmine-suite', id: 'suite-' + resultNode.result.id },
|
424
|
+
createDom(
|
425
|
+
'li',
|
426
|
+
{
|
427
|
+
className:
|
428
|
+
'jasmine-suite-detail jasmine-' + resultNode.result.status
|
429
|
+
},
|
430
|
+
createDom(
|
431
|
+
'a',
|
432
|
+
{ href: specHref(resultNode.result) },
|
433
|
+
resultNode.result.description
|
434
|
+
)
|
312
435
|
)
|
313
436
|
);
|
314
437
|
|
@@ -317,85 +440,133 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
317
440
|
}
|
318
441
|
if (resultNode.type === 'spec') {
|
319
442
|
if (domParent.getAttribute('class') !== 'jasmine-specs') {
|
320
|
-
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
443
|
+
specListNode = createDom('ul', { className: 'jasmine-specs' });
|
321
444
|
domParent.appendChild(specListNode);
|
322
445
|
}
|
323
446
|
var specDescription = resultNode.result.description;
|
324
|
-
if(noExpectations(resultNode.result)) {
|
447
|
+
if (noExpectations(resultNode.result)) {
|
325
448
|
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
326
449
|
}
|
327
|
-
if(
|
328
|
-
|
450
|
+
if (
|
451
|
+
resultNode.result.status === 'pending' &&
|
452
|
+
resultNode.result.pendingReason !== ''
|
453
|
+
) {
|
454
|
+
specDescription =
|
455
|
+
specDescription +
|
456
|
+
' PENDING WITH MESSAGE: ' +
|
457
|
+
resultNode.result.pendingReason;
|
329
458
|
}
|
330
459
|
specListNode.appendChild(
|
331
|
-
createDom(
|
460
|
+
createDom(
|
461
|
+
'li',
|
462
|
+
{
|
332
463
|
className: 'jasmine-' + resultNode.result.status,
|
333
464
|
id: 'spec-' + resultNode.result.id
|
334
465
|
},
|
335
|
-
createDom(
|
466
|
+
createDom(
|
467
|
+
'a',
|
468
|
+
{ href: specHref(resultNode.result) },
|
469
|
+
specDescription
|
470
|
+
)
|
336
471
|
)
|
337
472
|
);
|
338
473
|
}
|
339
474
|
}
|
340
475
|
}
|
341
476
|
|
342
|
-
function optionsMenu(
|
343
|
-
var optionsMenuDom = createDom(
|
477
|
+
function optionsMenu(config) {
|
478
|
+
var optionsMenuDom = createDom(
|
479
|
+
'div',
|
480
|
+
{ className: 'jasmine-run-options' },
|
344
481
|
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
345
|
-
createDom(
|
346
|
-
|
482
|
+
createDom(
|
483
|
+
'div',
|
484
|
+
{ className: 'jasmine-payload' },
|
485
|
+
createDom(
|
486
|
+
'div',
|
487
|
+
{ className: 'jasmine-stop-on-failure' },
|
347
488
|
createDom('input', {
|
348
489
|
className: 'jasmine-fail-fast',
|
349
490
|
id: 'jasmine-fail-fast',
|
350
491
|
type: 'checkbox'
|
351
492
|
}),
|
352
|
-
createDom(
|
353
|
-
|
493
|
+
createDom(
|
494
|
+
'label',
|
495
|
+
{ className: 'jasmine-label', for: 'jasmine-fail-fast' },
|
496
|
+
'stop execution on spec failure'
|
497
|
+
)
|
498
|
+
),
|
499
|
+
createDom(
|
500
|
+
'div',
|
501
|
+
{ className: 'jasmine-throw-failures' },
|
354
502
|
createDom('input', {
|
355
503
|
className: 'jasmine-throw',
|
356
504
|
id: 'jasmine-throw-failures',
|
357
505
|
type: 'checkbox'
|
358
506
|
}),
|
359
|
-
createDom(
|
360
|
-
|
507
|
+
createDom(
|
508
|
+
'label',
|
509
|
+
{ className: 'jasmine-label', for: 'jasmine-throw-failures' },
|
510
|
+
'stop spec on expectation failure'
|
511
|
+
)
|
512
|
+
),
|
513
|
+
createDom(
|
514
|
+
'div',
|
515
|
+
{ className: 'jasmine-random-order' },
|
361
516
|
createDom('input', {
|
362
517
|
className: 'jasmine-random',
|
363
518
|
id: 'jasmine-random-order',
|
364
519
|
type: 'checkbox'
|
365
520
|
}),
|
366
|
-
createDom(
|
367
|
-
|
521
|
+
createDom(
|
522
|
+
'label',
|
523
|
+
{ className: 'jasmine-label', for: 'jasmine-random-order' },
|
524
|
+
'run tests in random order'
|
525
|
+
)
|
526
|
+
),
|
527
|
+
createDom(
|
528
|
+
'div',
|
529
|
+
{ className: 'jasmine-hide-disabled' },
|
368
530
|
createDom('input', {
|
369
531
|
className: 'jasmine-disabled',
|
370
532
|
id: 'jasmine-hide-disabled',
|
371
533
|
type: 'checkbox'
|
372
534
|
}),
|
373
|
-
createDom(
|
535
|
+
createDom(
|
536
|
+
'label',
|
537
|
+
{ className: 'jasmine-label', for: 'jasmine-hide-disabled' },
|
538
|
+
'hide disabled tests'
|
539
|
+
)
|
540
|
+
)
|
374
541
|
)
|
375
542
|
);
|
376
543
|
|
377
544
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
378
|
-
failFastCheckbox.checked =
|
545
|
+
failFastCheckbox.checked = config.failFast;
|
379
546
|
failFastCheckbox.onclick = function() {
|
380
|
-
navigateWithNewParam('failFast', !
|
547
|
+
navigateWithNewParam('failFast', !config.failFast);
|
381
548
|
};
|
382
549
|
|
383
|
-
var throwCheckbox = optionsMenuDom.querySelector(
|
384
|
-
|
550
|
+
var throwCheckbox = optionsMenuDom.querySelector(
|
551
|
+
'#jasmine-throw-failures'
|
552
|
+
);
|
553
|
+
throwCheckbox.checked = config.oneFailurePerSpec;
|
385
554
|
throwCheckbox.onclick = function() {
|
386
|
-
navigateWithNewParam('throwFailures', !
|
555
|
+
navigateWithNewParam('throwFailures', !config.oneFailurePerSpec);
|
387
556
|
};
|
388
557
|
|
389
|
-
var randomCheckbox = optionsMenuDom.querySelector(
|
390
|
-
|
558
|
+
var randomCheckbox = optionsMenuDom.querySelector(
|
559
|
+
'#jasmine-random-order'
|
560
|
+
);
|
561
|
+
randomCheckbox.checked = config.random;
|
391
562
|
randomCheckbox.onclick = function() {
|
392
|
-
navigateWithNewParam('random', !
|
563
|
+
navigateWithNewParam('random', !config.random);
|
393
564
|
};
|
394
565
|
|
395
566
|
var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled');
|
396
|
-
hideDisabled.checked =
|
567
|
+
hideDisabled.checked = config.hideDisabled;
|
397
568
|
hideDisabled.onclick = function() {
|
398
|
-
navigateWithNewParam('hideDisabled', !
|
569
|
+
navigateWithNewParam('hideDisabled', !config.hideDisabled);
|
399
570
|
};
|
400
571
|
|
401
572
|
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
|
@@ -404,7 +575,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
404
575
|
|
405
576
|
optionsTrigger.onclick = function() {
|
406
577
|
if (isOpen.test(optionsPayload.className)) {
|
407
|
-
optionsPayload.className = optionsPayload.className.replace(
|
578
|
+
optionsPayload.className = optionsPayload.className.replace(
|
579
|
+
isOpen,
|
580
|
+
''
|
581
|
+
);
|
408
582
|
} else {
|
409
583
|
optionsPayload.className += ' jasmine-open';
|
410
584
|
}
|
@@ -414,14 +588,24 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
414
588
|
}
|
415
589
|
|
416
590
|
function failureDescription(result, suite) {
|
417
|
-
var wrapper = createDom(
|
418
|
-
|
591
|
+
var wrapper = createDom(
|
592
|
+
'div',
|
593
|
+
{ className: 'jasmine-description' },
|
594
|
+
createDom(
|
595
|
+
'a',
|
596
|
+
{ title: result.description, href: specHref(result) },
|
597
|
+
result.description
|
598
|
+
)
|
419
599
|
);
|
420
600
|
var suiteLink;
|
421
601
|
|
422
602
|
while (suite && suite.parent) {
|
423
603
|
wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
|
424
|
-
suiteLink = createDom(
|
604
|
+
suiteLink = createDom(
|
605
|
+
'a',
|
606
|
+
{ href: suiteHref(suite) },
|
607
|
+
suite.result.description
|
608
|
+
);
|
425
609
|
wrapper.insertBefore(suiteLink, wrapper.firstChild);
|
426
610
|
|
427
611
|
suite = suite.parent;
|
@@ -443,7 +627,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
443
627
|
|
444
628
|
function addDeprecationWarnings(result) {
|
445
629
|
if (result && result.deprecationWarnings) {
|
446
|
-
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
630
|
+
for (var i = 0; i < result.deprecationWarnings.length; i++) {
|
447
631
|
var warning = result.deprecationWarnings[i].message;
|
448
632
|
if (!j$.util.arrayContains(warning)) {
|
449
633
|
deprecationWarnings.push(warning);
|
@@ -460,7 +644,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
460
644
|
// return the reporter
|
461
645
|
var oldReporter = find('');
|
462
646
|
|
463
|
-
if(oldReporter) {
|
647
|
+
if (oldReporter) {
|
464
648
|
getContainer().removeChild(oldReporter);
|
465
649
|
}
|
466
650
|
}
|
@@ -492,7 +676,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
492
676
|
}
|
493
677
|
|
494
678
|
function pluralize(singular, count) {
|
495
|
-
var word =
|
679
|
+
var word = count == 1 ? singular : singular + 's';
|
496
680
|
|
497
681
|
return '' + count + ' ' + word;
|
498
682
|
}
|
@@ -514,8 +698,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
514
698
|
}
|
515
699
|
|
516
700
|
function noExpectations(result) {
|
517
|
-
|
518
|
-
result.
|
701
|
+
var allExpectations =
|
702
|
+
result.failedExpectations.length + result.passedExpectations.length;
|
703
|
+
|
704
|
+
return (
|
705
|
+
allExpectations === 0 &&
|
706
|
+
(result.status === 'passed' || result.status === 'failed')
|
707
|
+
);
|
519
708
|
}
|
520
709
|
|
521
710
|
function hasActiveSpec(resultNode) {
|
@@ -538,7 +727,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
538
727
|
|
539
728
|
jasmineRequire.HtmlSpecFilter = function() {
|
540
729
|
function HtmlSpecFilter(options) {
|
541
|
-
var filterString =
|
730
|
+
var filterString =
|
731
|
+
options &&
|
732
|
+
options.filterString() &&
|
733
|
+
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
542
734
|
var filterPattern = new RegExp(filterString);
|
543
735
|
|
544
736
|
this.matches = function(specName) {
|
@@ -575,9 +767,11 @@ jasmineRequire.ResultsNode = function() {
|
|
575
767
|
|
576
768
|
jasmineRequire.QueryString = function() {
|
577
769
|
function QueryString(options) {
|
578
|
-
|
579
770
|
this.navigateWithNewParam = function(key, value) {
|
580
|
-
options.getWindowLocation().search = this.fullStringWithNewParam(
|
771
|
+
options.getWindowLocation().search = this.fullStringWithNewParam(
|
772
|
+
key,
|
773
|
+
value
|
774
|
+
);
|
581
775
|
};
|
582
776
|
|
583
777
|
this.fullStringWithNewParam = function(key, value) {
|
@@ -595,7 +789,9 @@ jasmineRequire.QueryString = function() {
|
|
595
789
|
function toQueryString(paramMap) {
|
596
790
|
var qStrPairs = [];
|
597
791
|
for (var prop in paramMap) {
|
598
|
-
qStrPairs.push(
|
792
|
+
qStrPairs.push(
|
793
|
+
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
|
794
|
+
);
|
599
795
|
}
|
600
796
|
return '?' + qStrPairs.join('&');
|
601
797
|
}
|
@@ -619,7 +815,6 @@ jasmineRequire.QueryString = function() {
|
|
619
815
|
|
620
816
|
return paramMap;
|
621
817
|
}
|
622
|
-
|
623
818
|
}
|
624
819
|
|
625
820
|
return QueryString;
|