jasmine-core 2.5.0 → 2.99.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/console/console.js +1 -1
- data/lib/jasmine-core/boot/boot.js +4 -1
- data/lib/jasmine-core/boot.js +5 -2
- data/lib/jasmine-core/jasmine-html.js +95 -31
- data/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine-core/jasmine.js +3635 -1684
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +10 -0
- data/lib/jasmine-core/spec/core/ClearStackSpec.js +137 -0
- data/lib/jasmine-core/spec/core/ClockSpec.js +94 -14
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +26 -8
- data/lib/jasmine-core/spec/core/EnvSpec.js +142 -10
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +52 -7
- data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +110 -0
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +132 -4
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +333 -23
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +16 -1
- data/lib/jasmine-core/spec/core/SpecSpec.js +30 -8
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +225 -1
- data/lib/jasmine-core/spec/core/SpySpec.js +44 -2
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +28 -5
- data/lib/jasmine-core/spec/core/SuiteSpec.js +14 -19
- data/lib/jasmine-core/spec/core/UserContextSpec.js +54 -0
- data/lib/jasmine-core/spec/core/UtilSpec.js +71 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +32 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +32 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +13 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +47 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +13 -0
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +48 -0
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +339 -38
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +156 -3
- data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +47 -0
- data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +13 -0
- data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +43 -0
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +231 -8
- data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +8 -0
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +42 -0
- data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +31 -0
- data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +31 -0
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +780 -4
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +99 -0
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +37 -0
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +4 -0
- data/lib/jasmine-core/spec/helpers/asyncAwait.js +27 -0
- data/lib/jasmine-core/spec/helpers/checkForMap.js +37 -0
- data/lib/jasmine-core/spec/helpers/checkForSet.js +41 -0
- data/lib/jasmine-core/spec/helpers/checkForSymbol.js +28 -0
- data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +20 -0
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +105 -23
- data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +34 -0
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fa6bc01f3bebe3af74f236043dfa248343ddb9c
|
4
|
+
data.tar.gz: 6e463032dd5611aa0fcae23f5747c3798169a772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2e443a7bacb5598138901ccca2e38f942c38c27105f46843f235d0cee3fd2d3bdc3d8f951e5b69b2c5e52df051300a030b171d64f534762be732421e3969b66
|
7
|
+
data.tar.gz: 63dc193aad536b5cce1bee3a3ec944c3a005b60fe023c7ef534463290d687ef0d2856840d66e7db52d4a6b73d5e33c1d646ca3f37be1e0cc74f35e85b4ca2e9c
|
data/lib/console/console.js
CHANGED
@@ -49,6 +49,8 @@
|
|
49
49
|
getWindowLocation: function() { return window.location; }
|
50
50
|
});
|
51
51
|
|
52
|
+
var filterSpecs = !!queryString.getParam("spec");
|
53
|
+
|
52
54
|
var catchingExceptions = queryString.getParam("catch");
|
53
55
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
54
56
|
|
@@ -76,7 +78,8 @@
|
|
76
78
|
getContainer: function() { return document.body; },
|
77
79
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
78
80
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
79
|
-
timer: new jasmine.Timer()
|
81
|
+
timer: new jasmine.Timer(),
|
82
|
+
filterSpecs: filterSpecs
|
80
83
|
});
|
81
84
|
|
82
85
|
/**
|
data/lib/jasmine-core/boot.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2018 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
|
@@ -71,6 +71,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
71
71
|
getWindowLocation: function() { return window.location; }
|
72
72
|
});
|
73
73
|
|
74
|
+
var filterSpecs = !!queryString.getParam("spec");
|
75
|
+
|
74
76
|
var catchingExceptions = queryString.getParam("catch");
|
75
77
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
76
78
|
|
@@ -98,7 +100,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
98
100
|
getContainer: function() { return document.body; },
|
99
101
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
100
102
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
101
|
-
timer: new jasmine.Timer()
|
103
|
+
timer: new jasmine.Timer(),
|
104
|
+
filterSpecs: filterSpecs
|
102
105
|
});
|
103
106
|
|
104
107
|
/**
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2018 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
|
@@ -34,6 +34,46 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
34
34
|
elapsed: function() { return 0; }
|
35
35
|
};
|
36
36
|
|
37
|
+
function ResultsStateBuilder() {
|
38
|
+
this.topResults = new j$.ResultsNode({}, '', null);
|
39
|
+
this.currentParent = this.topResults;
|
40
|
+
this.specsExecuted = 0;
|
41
|
+
this.failureCount = 0;
|
42
|
+
this.pendingSpecCount = 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
ResultsStateBuilder.prototype.suiteStarted = function(result) {
|
46
|
+
this.currentParent.addChild(result, 'suite');
|
47
|
+
this.currentParent = this.currentParent.last();
|
48
|
+
};
|
49
|
+
|
50
|
+
ResultsStateBuilder.prototype.suiteDone = function(result) {
|
51
|
+
if (this.currentParent !== this.topResults) {
|
52
|
+
this.currentParent = this.currentParent.parent;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
ResultsStateBuilder.prototype.specStarted = function(result) {
|
57
|
+
};
|
58
|
+
|
59
|
+
ResultsStateBuilder.prototype.specDone = function(result) {
|
60
|
+
this.currentParent.addChild(result, 'spec');
|
61
|
+
|
62
|
+
if (result.status !== 'disabled') {
|
63
|
+
this.specsExecuted++;
|
64
|
+
}
|
65
|
+
|
66
|
+
if (result.status === 'failed') {
|
67
|
+
this.failureCount++;
|
68
|
+
}
|
69
|
+
|
70
|
+
if (result.status == 'pending') {
|
71
|
+
this.pendingSpecCount++;
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
|
76
|
+
|
37
77
|
function HtmlReporter(options) {
|
38
78
|
var env = options.env || {},
|
39
79
|
getContainer = options.getContainer,
|
@@ -43,14 +83,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
43
83
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
44
84
|
onRandomClick = options.onRandomClick || function() {},
|
45
85
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
86
|
+
filterSpecs = options.filterSpecs,
|
46
87
|
timer = options.timer || noopTimer,
|
47
88
|
results = [],
|
48
|
-
specsExecuted = 0,
|
49
|
-
failureCount = 0,
|
50
|
-
pendingSpecCount = 0,
|
51
89
|
htmlReporterMain,
|
52
90
|
symbols,
|
53
|
-
failedSuites = []
|
91
|
+
failedSuites = [],
|
92
|
+
deprecationWarnings = [];
|
54
93
|
|
55
94
|
this.initialize = function() {
|
56
95
|
clearPrior();
|
@@ -76,12 +115,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
76
115
|
|
77
116
|
var summary = createDom('div', {className: 'jasmine-summary'});
|
78
117
|
|
79
|
-
var
|
80
|
-
currentParent = topResults;
|
118
|
+
var stateBuilder = new ResultsStateBuilder();
|
81
119
|
|
82
120
|
this.suiteStarted = function(result) {
|
83
|
-
|
84
|
-
currentParent = currentParent.last();
|
121
|
+
stateBuilder.suiteStarted(result);
|
85
122
|
};
|
86
123
|
|
87
124
|
this.suiteDone = function(result) {
|
@@ -89,27 +126,22 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
89
126
|
failedSuites.push(result);
|
90
127
|
}
|
91
128
|
|
92
|
-
|
93
|
-
|
94
|
-
}
|
95
|
-
|
96
|
-
currentParent = currentParent.parent;
|
129
|
+
stateBuilder.suiteDone(result);
|
130
|
+
addDeprecationWarnings(result);
|
97
131
|
};
|
98
132
|
|
99
133
|
this.specStarted = function(result) {
|
100
|
-
|
134
|
+
stateBuilder.specStarted(result);
|
101
135
|
};
|
102
136
|
|
103
137
|
var failures = [];
|
104
138
|
this.specDone = function(result) {
|
139
|
+
stateBuilder.specDone(result);
|
140
|
+
|
105
141
|
if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
|
106
142
|
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
107
143
|
}
|
108
144
|
|
109
|
-
if (result.status != 'disabled') {
|
110
|
-
specsExecuted++;
|
111
|
-
}
|
112
|
-
|
113
145
|
if (!symbols){
|
114
146
|
symbols = find('.jasmine-symbol-summary');
|
115
147
|
}
|
@@ -122,8 +154,6 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
122
154
|
));
|
123
155
|
|
124
156
|
if (result.status == 'failed') {
|
125
|
-
failureCount++;
|
126
|
-
|
127
157
|
var failure =
|
128
158
|
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
129
159
|
createDom('div', {className: 'jasmine-description'},
|
@@ -142,9 +172,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
142
172
|
failures.push(failure);
|
143
173
|
}
|
144
174
|
|
145
|
-
|
146
|
-
pendingSpecCount++;
|
147
|
-
}
|
175
|
+
addDeprecationWarnings(result);
|
148
176
|
};
|
149
177
|
|
150
178
|
this.jasmineDone = function(doneResult) {
|
@@ -207,9 +235,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
207
235
|
}
|
208
236
|
};
|
209
237
|
|
210
|
-
if (specsExecuted < totalSpecsDefined) {
|
211
|
-
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
212
|
-
var skippedLink =
|
238
|
+
if (stateBuilder.specsExecuted < totalSpecsDefined) {
|
239
|
+
var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
240
|
+
var skippedLink = addToExistingQueryString('spec', '');
|
213
241
|
alert.appendChild(
|
214
242
|
createDom('span', {className: 'jasmine-bar jasmine-skipped'},
|
215
243
|
createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage)
|
@@ -220,9 +248,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
220
248
|
var statusBarClassName = 'jasmine-bar ';
|
221
249
|
|
222
250
|
if (totalSpecsDefined > 0) {
|
223
|
-
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
224
|
-
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
225
|
-
statusBarClassName += (failureCount > 0) ? 'jasmine-failed' : 'jasmine-passed';
|
251
|
+
statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount);
|
252
|
+
if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); }
|
253
|
+
statusBarClassName += (stateBuilder.failureCount > 0) ? 'jasmine-failed' : 'jasmine-passed';
|
226
254
|
} else {
|
227
255
|
statusBarClassName += 'jasmine-skipped';
|
228
256
|
statusBarMessage += 'No specs found';
|
@@ -254,15 +282,26 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
254
282
|
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
|
255
283
|
}
|
256
284
|
|
285
|
+
addDeprecationWarnings(doneResult);
|
286
|
+
|
287
|
+
var warningBarClassName = 'jasmine-bar jasmine-warning';
|
288
|
+
for(i = 0; i < deprecationWarnings.length; i++) {
|
289
|
+
var warning = deprecationWarnings[i];
|
290
|
+
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
|
291
|
+
}
|
292
|
+
|
257
293
|
var results = find('.jasmine-results');
|
258
294
|
results.appendChild(summary);
|
259
295
|
|
260
|
-
summaryList(topResults, summary);
|
296
|
+
summaryList(stateBuilder.topResults, summary);
|
261
297
|
|
262
298
|
function summaryList(resultsTree, domParent) {
|
263
299
|
var specListNode;
|
264
300
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
265
301
|
var resultNode = resultsTree.children[i];
|
302
|
+
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
303
|
+
continue;
|
304
|
+
}
|
266
305
|
if (resultNode.type == 'suite') {
|
267
306
|
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
268
307
|
createDom('li', {className: 'jasmine-suite-detail'},
|
@@ -325,6 +364,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
325
364
|
|
326
365
|
return this;
|
327
366
|
|
367
|
+
function addDeprecationWarnings(result) {
|
368
|
+
if (result && result.deprecationWarnings) {
|
369
|
+
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
370
|
+
var warning = result.deprecationWarnings[i].message;
|
371
|
+
if (!j$.util.arrayContains(warning)) {
|
372
|
+
deprecationWarnings.push(warning);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
328
378
|
function find(selector) {
|
329
379
|
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
330
380
|
}
|
@@ -390,6 +440,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
390
440
|
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
391
441
|
result.status === 'passed';
|
392
442
|
}
|
443
|
+
|
444
|
+
function hasActiveSpec(resultNode) {
|
445
|
+
if (resultNode.type == 'spec' && resultNode.result.status != 'disabled') {
|
446
|
+
return true;
|
447
|
+
}
|
448
|
+
|
449
|
+
if (resultNode.type == 'suite') {
|
450
|
+
for (var i = 0, j = resultNode.children.length; i < j; i++) {
|
451
|
+
if (hasActiveSpec(resultNode.children[i])) {
|
452
|
+
return true;
|
453
|
+
}
|
454
|
+
}
|
455
|
+
}
|
456
|
+
}
|
393
457
|
}
|
394
458
|
|
395
459
|
return HtmlReporter;
|
@@ -33,6 +33,7 @@ body { overflow-y: scroll; }
|
|
33
33
|
.jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; }
|
34
34
|
.jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; }
|
35
35
|
.jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; }
|
36
|
+
.jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; color: #333; }
|
36
37
|
.jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; }
|
37
38
|
.jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; }
|
38
39
|
.jasmine_html-reporter .jasmine-bar a { color: white; }
|