jasmine-core 2.99.2 → 3.0.0
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 +7 -6
- data/lib/jasmine-core/boot/boot.js +7 -6
- data/lib/jasmine-core/boot/node_boot.js +0 -3
- data/lib/jasmine-core/jasmine-html.js +228 -137
- data/lib/jasmine-core/jasmine.css +11 -5
- data/lib/jasmine-core/jasmine.js +1046 -608
- data/lib/jasmine-core/node_boot.js +0 -3
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +130 -0
- data/lib/jasmine-core/spec/core/ClearStackSpec.js +137 -0
- data/lib/jasmine-core/spec/core/ClockSpec.js +710 -0
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +286 -0
- data/lib/jasmine-core/spec/core/EnvSpec.js +200 -0
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +120 -0
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +46 -0
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +61 -0
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +434 -0
- data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +110 -0
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +259 -0
- data/lib/jasmine-core/spec/core/MockDateSpec.js +200 -0
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +332 -0
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +670 -0
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +140 -0
- data/lib/jasmine-core/spec/core/SpecSpec.js +407 -0
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +364 -0
- data/lib/jasmine-core/spec/core/SpySpec.js +177 -0
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +202 -0
- data/lib/jasmine-core/spec/core/StackTraceSpec.js +166 -0
- data/lib/jasmine-core/spec/core/SuiteSpec.js +123 -0
- data/lib/jasmine-core/spec/core/TimerSpec.js +31 -0
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +794 -0
- data/lib/jasmine-core/spec/core/UserContextSpec.js +54 -0
- data/lib/jasmine-core/spec/core/UtilSpec.js +105 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +91 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +76 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +52 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +47 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +99 -0
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +27 -0
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +13 -0
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +200 -0
- data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +138 -0
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +2344 -0
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +976 -0
- 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 +645 -0
- data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +8 -0
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +93 -0
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +18 -0
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +38 -0
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +29 -0
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +20 -0
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +29 -0
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +20 -0
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +37 -0
- data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +31 -0
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +17 -0
- data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +31 -0
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +17 -0
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +38 -0
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +18 -0
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +26 -0
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +785 -0
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +99 -0
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +47 -0
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +86 -0
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +67 -0
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +43 -0
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +315 -0
- data/lib/jasmine-core/spec/core/matchers/toThrowMatchingSpec.js +73 -0
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +100 -0
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +15 -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/helpers/defineJasmineUnderTest.js +6 -0
- data/lib/jasmine-core/spec/helpers/integrationMatchers.js +43 -0
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +30 -0
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +1261 -0
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +18 -0
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +37 -0
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +27 -0
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +72 -0
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +62 -0
- data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +39 -0
- data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +48 -0
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +101 -0
- data/lib/jasmine-core/spec/performance/large_object_test.js +36 -0
- data/lib/jasmine-core/spec/performance/performance_test.js +10 -0
- data/lib/jasmine-core/version.rb +1 -1
- metadata +88 -4
- data/lib/console/console.js +0 -190
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e5647f35a2c17871621df2d1822a77c638e2a84
|
4
|
+
data.tar.gz: 0d30ae54baae843527b0e057715e55766df4b01d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 366cce7b5d79ec3defff32ac37246dd92df9418e81c2b9f575f92d58de658337c2b7fab46d5c4f83902ae8165a66f1628e80cdc171394107e851cd93c6742219
|
7
|
+
data.tar.gz: b0b62b54f3d7c85d5289227fa5f40417a6e59c481848972e50425ce1215e97f1cccbe3dc737ea30f016ad2695d591e0e5ad48b6a5546d15b1a292e49e7f5b503
|
data/lib/jasmine-core/boot.js
CHANGED
@@ -73,14 +73,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
73
73
|
|
74
74
|
var filterSpecs = !!queryString.getParam("spec");
|
75
75
|
|
76
|
-
var
|
77
|
-
env.
|
76
|
+
var stoppingOnSpecFailure = queryString.getParam("failFast");
|
77
|
+
env.stopOnSpecFailure(stoppingOnSpecFailure);
|
78
78
|
|
79
79
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
80
80
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
81
81
|
|
82
82
|
var random = queryString.getParam("random");
|
83
|
-
|
83
|
+
|
84
|
+
if (random !== undefined && random !== "") {
|
85
|
+
env.randomizeTests(random);
|
86
|
+
}
|
84
87
|
|
85
88
|
var seed = queryString.getParam("seed");
|
86
89
|
if (seed) {
|
@@ -93,9 +96,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
93
96
|
*/
|
94
97
|
var htmlReporter = new jasmine.HtmlReporter({
|
95
98
|
env: env,
|
96
|
-
|
97
|
-
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
98
|
-
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
99
|
+
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
|
99
100
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
100
101
|
getContainer: function() { return document.body; },
|
101
102
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -51,14 +51,17 @@
|
|
51
51
|
|
52
52
|
var filterSpecs = !!queryString.getParam("spec");
|
53
53
|
|
54
|
-
var
|
55
|
-
env.
|
54
|
+
var stoppingOnSpecFailure = queryString.getParam("failFast");
|
55
|
+
env.stopOnSpecFailure(stoppingOnSpecFailure);
|
56
56
|
|
57
57
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
58
58
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
59
59
|
|
60
60
|
var random = queryString.getParam("random");
|
61
|
-
|
61
|
+
|
62
|
+
if (random !== undefined && random !== "") {
|
63
|
+
env.randomizeTests(random);
|
64
|
+
}
|
62
65
|
|
63
66
|
var seed = queryString.getParam("seed");
|
64
67
|
if (seed) {
|
@@ -71,9 +74,7 @@
|
|
71
74
|
*/
|
72
75
|
var htmlReporter = new jasmine.HtmlReporter({
|
73
76
|
env: env,
|
74
|
-
|
75
|
-
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
76
|
-
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
77
|
+
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
|
77
78
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
78
79
|
getContainer: function() { return document.body; },
|
79
80
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module.exports = function(jasmineRequire) {
|
2
2
|
var jasmine = jasmineRequire.core(jasmineRequire);
|
3
3
|
|
4
|
-
var consoleFns = require('../console/console.js');
|
5
|
-
consoleFns.console(consoleFns, jasmine);
|
6
|
-
|
7
4
|
var env = jasmine.getEnv();
|
8
5
|
|
9
6
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
@@ -25,6 +25,7 @@ jasmineRequire.html = function(j$) {
|
|
25
25
|
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
26
26
|
j$.QueryString = jasmineRequire.QueryString();
|
27
27
|
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
28
|
+
j$.matchers.toHaveClass = jasmineRequire.toHaveClass(j$);
|
28
29
|
};
|
29
30
|
|
30
31
|
jasmineRequire.HtmlReporter = function(j$) {
|
@@ -48,9 +49,14 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
48
49
|
};
|
49
50
|
|
50
51
|
ResultsStateBuilder.prototype.suiteDone = function(result) {
|
52
|
+
this.currentParent.updateResult(result);
|
51
53
|
if (this.currentParent !== this.topResults) {
|
52
54
|
this.currentParent = this.currentParent.parent;
|
53
55
|
}
|
56
|
+
|
57
|
+
if (result.status === 'failed') {
|
58
|
+
this.failureCount++;
|
59
|
+
}
|
54
60
|
};
|
55
61
|
|
56
62
|
ResultsStateBuilder.prototype.specStarted = function(result) {
|
@@ -59,7 +65,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
59
65
|
ResultsStateBuilder.prototype.specDone = function(result) {
|
60
66
|
this.currentParent.addChild(result, 'spec');
|
61
67
|
|
62
|
-
if (result.status !== '
|
68
|
+
if (result.status !== 'excluded') {
|
63
69
|
this.specsExecuted++;
|
64
70
|
}
|
65
71
|
|
@@ -79,16 +85,12 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
79
85
|
getContainer = options.getContainer,
|
80
86
|
createElement = options.createElement,
|
81
87
|
createTextNode = options.createTextNode,
|
82
|
-
|
83
|
-
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
84
|
-
onRandomClick = options.onRandomClick || function() {},
|
88
|
+
navigateWithNewParam = options.navigateWithNewParam || function() {},
|
85
89
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
86
90
|
filterSpecs = options.filterSpecs,
|
87
91
|
timer = options.timer || noopTimer,
|
88
|
-
results = [],
|
89
92
|
htmlReporterMain,
|
90
93
|
symbols,
|
91
|
-
failedSuites = [],
|
92
94
|
deprecationWarnings = [];
|
93
95
|
|
94
96
|
this.initialize = function() {
|
@@ -122,11 +124,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
122
124
|
};
|
123
125
|
|
124
126
|
this.suiteDone = function(result) {
|
125
|
-
if (result.status == 'failed') {
|
126
|
-
failedSuites.push(result);
|
127
|
-
}
|
128
|
-
|
129
127
|
stateBuilder.suiteDone(result);
|
128
|
+
|
129
|
+
if (result.status === 'failed') {
|
130
|
+
failures.push(failureDom(result));
|
131
|
+
}
|
130
132
|
addDeprecationWarnings(result);
|
131
133
|
};
|
132
134
|
|
@@ -153,23 +155,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
153
155
|
}
|
154
156
|
));
|
155
157
|
|
156
|
-
if (result.status
|
157
|
-
|
158
|
-
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
159
|
-
createDom('div', {className: 'jasmine-description'},
|
160
|
-
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
161
|
-
),
|
162
|
-
createDom('div', {className: 'jasmine-messages'})
|
163
|
-
);
|
164
|
-
var messages = failure.childNodes[1];
|
165
|
-
|
166
|
-
for (var i = 0; i < result.failedExpectations.length; i++) {
|
167
|
-
var expectation = result.failedExpectations[i];
|
168
|
-
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
|
169
|
-
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
|
170
|
-
}
|
171
|
-
|
172
|
-
failures.push(failure);
|
158
|
+
if (result.status === 'failed') {
|
159
|
+
failures.push(failureDom(result));
|
173
160
|
}
|
174
161
|
|
175
162
|
addDeprecationWarnings(result);
|
@@ -181,59 +168,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
181
168
|
var order = doneResult && doneResult.order;
|
182
169
|
alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
183
170
|
|
184
|
-
banner.appendChild(
|
185
|
-
createDom('div', { className: 'jasmine-run-options' },
|
186
|
-
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
187
|
-
createDom('div', { className: 'jasmine-payload' },
|
188
|
-
createDom('div', { className: 'jasmine-exceptions' },
|
189
|
-
createDom('input', {
|
190
|
-
className: 'jasmine-raise',
|
191
|
-
id: 'jasmine-raise-exceptions',
|
192
|
-
type: 'checkbox'
|
193
|
-
}),
|
194
|
-
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-raise-exceptions' }, 'raise exceptions')),
|
195
|
-
createDom('div', { className: 'jasmine-throw-failures' },
|
196
|
-
createDom('input', {
|
197
|
-
className: 'jasmine-throw',
|
198
|
-
id: 'jasmine-throw-failures',
|
199
|
-
type: 'checkbox'
|
200
|
-
}),
|
201
|
-
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
|
202
|
-
createDom('div', { className: 'jasmine-random-order' },
|
203
|
-
createDom('input', {
|
204
|
-
className: 'jasmine-random',
|
205
|
-
id: 'jasmine-random-order',
|
206
|
-
type: 'checkbox'
|
207
|
-
}),
|
208
|
-
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
209
|
-
)
|
210
|
-
));
|
211
|
-
|
212
|
-
var raiseCheckbox = find('#jasmine-raise-exceptions');
|
213
|
-
|
214
|
-
raiseCheckbox.checked = !env.catchingExceptions();
|
215
|
-
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
216
|
-
|
217
|
-
var throwCheckbox = find('#jasmine-throw-failures');
|
218
|
-
throwCheckbox.checked = env.throwingExpectationFailures();
|
219
|
-
throwCheckbox.onclick = onThrowExpectationsClick;
|
220
|
-
|
221
|
-
var randomCheckbox = find('#jasmine-random-order');
|
222
|
-
randomCheckbox.checked = env.randomTests();
|
223
|
-
randomCheckbox.onclick = onRandomClick;
|
224
|
-
|
225
|
-
var optionsMenu = find('.jasmine-run-options'),
|
226
|
-
optionsTrigger = optionsMenu.querySelector('.jasmine-trigger'),
|
227
|
-
optionsPayload = optionsMenu.querySelector('.jasmine-payload'),
|
228
|
-
isOpen = /\bjasmine-open\b/;
|
229
|
-
|
230
|
-
optionsTrigger.onclick = function() {
|
231
|
-
if (isOpen.test(optionsPayload.className)) {
|
232
|
-
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
233
|
-
} else {
|
234
|
-
optionsPayload.className += ' jasmine-open';
|
235
|
-
}
|
236
|
-
};
|
171
|
+
banner.appendChild(optionsMenu(env));
|
237
172
|
|
238
173
|
if (stateBuilder.specsExecuted < totalSpecsDefined) {
|
239
174
|
var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
@@ -245,15 +180,22 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
245
180
|
);
|
246
181
|
}
|
247
182
|
var statusBarMessage = '';
|
248
|
-
var statusBarClassName = 'jasmine-bar ';
|
183
|
+
var statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
184
|
+
var globalFailures = (doneResult && doneResult.failedExpectations) || [];
|
185
|
+
var failed = stateBuilder.failureCount + globalFailures.length > 0;
|
249
186
|
|
250
|
-
if (totalSpecsDefined > 0) {
|
187
|
+
if (totalSpecsDefined > 0 || failed) {
|
251
188
|
statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount);
|
252
189
|
if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); }
|
253
|
-
|
190
|
+
}
|
191
|
+
|
192
|
+
if (doneResult.overallStatus === 'passed') {
|
193
|
+
statusBarClassName += ' jasmine-passed ';
|
194
|
+
} else if (doneResult.overallStatus === 'incomplete') {
|
195
|
+
statusBarClassName += ' jasmine-incomplete ';
|
196
|
+
statusBarMessage = 'Incomplete: ' + doneResult.incompleteReason + ', ' + statusBarMessage;
|
254
197
|
} else {
|
255
|
-
statusBarClassName += 'jasmine-
|
256
|
-
statusBarMessage += 'No specs found';
|
198
|
+
statusBarClassName += ' jasmine-failed ';
|
257
199
|
}
|
258
200
|
|
259
201
|
var seedBar;
|
@@ -267,19 +209,24 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
267
209
|
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
|
268
210
|
|
269
211
|
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
270
|
-
var
|
212
|
+
var afterAllMessagePrefix = 'AfterAll ';
|
271
213
|
|
272
|
-
for(
|
273
|
-
|
274
|
-
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
275
|
-
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failedSuite.failedExpectations[j].message));
|
276
|
-
}
|
214
|
+
for(i = 0; i < globalFailures.length; i++) {
|
215
|
+
alert.appendChild(createDom('span', {className: errorBarClassName}, globalFailureMessage(globalFailures[i])));
|
277
216
|
}
|
278
217
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
218
|
+
function globalFailureMessage(failure) {
|
219
|
+
if (failure.globalErrorType === 'load') {
|
220
|
+
var prefix = 'Error during loading: ' + failure.message;
|
221
|
+
|
222
|
+
if (failure.filename) {
|
223
|
+
return prefix + ' in ' + failure.filename + ' line ' + failure.lineno;
|
224
|
+
} else {
|
225
|
+
return prefix;
|
226
|
+
}
|
227
|
+
} else {
|
228
|
+
return afterAllMessagePrefix + failure.message;
|
229
|
+
}
|
283
230
|
}
|
284
231
|
|
285
232
|
addDeprecationWarnings(doneResult);
|
@@ -295,47 +242,6 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
295
242
|
|
296
243
|
summaryList(stateBuilder.topResults, summary);
|
297
244
|
|
298
|
-
function summaryList(resultsTree, domParent) {
|
299
|
-
var specListNode;
|
300
|
-
for (var i = 0; i < resultsTree.children.length; i++) {
|
301
|
-
var resultNode = resultsTree.children[i];
|
302
|
-
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
303
|
-
continue;
|
304
|
-
}
|
305
|
-
if (resultNode.type == 'suite') {
|
306
|
-
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
307
|
-
createDom('li', {className: 'jasmine-suite-detail'},
|
308
|
-
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
309
|
-
)
|
310
|
-
);
|
311
|
-
|
312
|
-
summaryList(resultNode, suiteListNode);
|
313
|
-
domParent.appendChild(suiteListNode);
|
314
|
-
}
|
315
|
-
if (resultNode.type == 'spec') {
|
316
|
-
if (domParent.getAttribute('class') != 'jasmine-specs') {
|
317
|
-
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
318
|
-
domParent.appendChild(specListNode);
|
319
|
-
}
|
320
|
-
var specDescription = resultNode.result.description;
|
321
|
-
if(noExpectations(resultNode.result)) {
|
322
|
-
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
323
|
-
}
|
324
|
-
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
|
325
|
-
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
|
326
|
-
}
|
327
|
-
specListNode.appendChild(
|
328
|
-
createDom('li', {
|
329
|
-
className: 'jasmine-' + resultNode.result.status,
|
330
|
-
id: 'spec-' + resultNode.result.id
|
331
|
-
},
|
332
|
-
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
333
|
-
)
|
334
|
-
);
|
335
|
-
}
|
336
|
-
}
|
337
|
-
}
|
338
|
-
|
339
245
|
if (failures.length) {
|
340
246
|
alert.appendChild(
|
341
247
|
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
|
@@ -364,6 +270,153 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
364
270
|
|
365
271
|
return this;
|
366
272
|
|
273
|
+
function failureDom(result) {
|
274
|
+
var failure =
|
275
|
+
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
|
276
|
+
failureDescription(result, stateBuilder.currentParent),
|
277
|
+
createDom('div', {className: 'jasmine-messages'})
|
278
|
+
);
|
279
|
+
var messages = failure.childNodes[1];
|
280
|
+
|
281
|
+
for (var i = 0; i < result.failedExpectations.length; i++) {
|
282
|
+
var expectation = result.failedExpectations[i];
|
283
|
+
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
|
284
|
+
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
|
285
|
+
}
|
286
|
+
|
287
|
+
return failure;
|
288
|
+
}
|
289
|
+
|
290
|
+
function summaryList(resultsTree, domParent) {
|
291
|
+
var specListNode;
|
292
|
+
for (var i = 0; i < resultsTree.children.length; i++) {
|
293
|
+
var resultNode = resultsTree.children[i];
|
294
|
+
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
295
|
+
continue;
|
296
|
+
}
|
297
|
+
if (resultNode.type === 'suite') {
|
298
|
+
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
|
299
|
+
createDom('li', {className: 'jasmine-suite-detail jasmine-' + resultNode.result.status},
|
300
|
+
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
301
|
+
)
|
302
|
+
);
|
303
|
+
|
304
|
+
summaryList(resultNode, suiteListNode);
|
305
|
+
domParent.appendChild(suiteListNode);
|
306
|
+
}
|
307
|
+
if (resultNode.type === 'spec') {
|
308
|
+
if (domParent.getAttribute('class') !== 'jasmine-specs') {
|
309
|
+
specListNode = createDom('ul', {className: 'jasmine-specs'});
|
310
|
+
domParent.appendChild(specListNode);
|
311
|
+
}
|
312
|
+
var specDescription = resultNode.result.description;
|
313
|
+
if(noExpectations(resultNode.result)) {
|
314
|
+
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
315
|
+
}
|
316
|
+
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
|
317
|
+
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
|
318
|
+
}
|
319
|
+
specListNode.appendChild(
|
320
|
+
createDom('li', {
|
321
|
+
className: 'jasmine-' + resultNode.result.status,
|
322
|
+
id: 'spec-' + resultNode.result.id
|
323
|
+
},
|
324
|
+
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
325
|
+
)
|
326
|
+
);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
function optionsMenu(env) {
|
332
|
+
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
333
|
+
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
334
|
+
createDom('div', { className: 'jasmine-payload' },
|
335
|
+
createDom('div', { className: 'jasmine-stop-on-failure' },
|
336
|
+
createDom('input', {
|
337
|
+
className: 'jasmine-fail-fast',
|
338
|
+
id: 'jasmine-fail-fast',
|
339
|
+
type: 'checkbox'
|
340
|
+
}),
|
341
|
+
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
|
342
|
+
createDom('div', { className: 'jasmine-throw-failures' },
|
343
|
+
createDom('input', {
|
344
|
+
className: 'jasmine-throw',
|
345
|
+
id: 'jasmine-throw-failures',
|
346
|
+
type: 'checkbox'
|
347
|
+
}),
|
348
|
+
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
|
349
|
+
createDom('div', { className: 'jasmine-random-order' },
|
350
|
+
createDom('input', {
|
351
|
+
className: 'jasmine-random',
|
352
|
+
id: 'jasmine-random-order',
|
353
|
+
type: 'checkbox'
|
354
|
+
}),
|
355
|
+
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order'))
|
356
|
+
)
|
357
|
+
);
|
358
|
+
|
359
|
+
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
360
|
+
failFastCheckbox.checked = env.stoppingOnSpecFailure();
|
361
|
+
failFastCheckbox.onclick = function() {
|
362
|
+
navigateWithNewParam('failFast', !env.stoppingOnSpecFailure());
|
363
|
+
};
|
364
|
+
|
365
|
+
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
366
|
+
throwCheckbox.checked = env.throwingExpectationFailures();
|
367
|
+
throwCheckbox.onclick = function() {
|
368
|
+
navigateWithNewParam('throwFailures', !env.throwingExpectationFailures());
|
369
|
+
};
|
370
|
+
|
371
|
+
var randomCheckbox = optionsMenuDom.querySelector('#jasmine-random-order');
|
372
|
+
randomCheckbox.checked = env.randomTests();
|
373
|
+
randomCheckbox.onclick = function() {
|
374
|
+
navigateWithNewParam('random', !env.randomTests());
|
375
|
+
};
|
376
|
+
|
377
|
+
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
|
378
|
+
optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
|
379
|
+
isOpen = /\bjasmine-open\b/;
|
380
|
+
|
381
|
+
optionsTrigger.onclick = function() {
|
382
|
+
if (isOpen.test(optionsPayload.className)) {
|
383
|
+
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
384
|
+
} else {
|
385
|
+
optionsPayload.className += ' jasmine-open';
|
386
|
+
}
|
387
|
+
};
|
388
|
+
|
389
|
+
return optionsMenuDom;
|
390
|
+
}
|
391
|
+
|
392
|
+
function failureDescription(result, suite) {
|
393
|
+
var wrapper = createDom('div', {className: 'jasmine-description'},
|
394
|
+
createDom('a', {title: result.description, href: specHref(result)}, result.description)
|
395
|
+
);
|
396
|
+
var suiteLink;
|
397
|
+
|
398
|
+
while (suite && suite.parent) {
|
399
|
+
wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
|
400
|
+
suiteLink = createDom('a', {href: suiteHref(suite)}, suite.result.description);
|
401
|
+
wrapper.insertBefore(suiteLink, wrapper.firstChild);
|
402
|
+
|
403
|
+
suite = suite.parent;
|
404
|
+
}
|
405
|
+
|
406
|
+
return wrapper;
|
407
|
+
}
|
408
|
+
|
409
|
+
function suiteHref(suite) {
|
410
|
+
var els = [];
|
411
|
+
|
412
|
+
while (suite && suite.parent) {
|
413
|
+
els.unshift(suite.result.description);
|
414
|
+
suite = suite.parent;
|
415
|
+
}
|
416
|
+
|
417
|
+
return addToExistingQueryString('spec', els.join(' '));
|
418
|
+
}
|
419
|
+
|
367
420
|
function addDeprecationWarnings(result) {
|
368
421
|
if (result && result.deprecationWarnings) {
|
369
422
|
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
@@ -442,7 +495,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
442
495
|
}
|
443
496
|
|
444
497
|
function hasActiveSpec(resultNode) {
|
445
|
-
if (resultNode.type == 'spec' && resultNode.result.status != '
|
498
|
+
if (resultNode.type == 'spec' && resultNode.result.status != 'excluded') {
|
446
499
|
return true;
|
447
500
|
}
|
448
501
|
|
@@ -487,6 +540,10 @@ jasmineRequire.ResultsNode = function() {
|
|
487
540
|
this.last = function() {
|
488
541
|
return this.children[this.children.length - 1];
|
489
542
|
};
|
543
|
+
|
544
|
+
this.updateResult = function(result) {
|
545
|
+
this.result = result;
|
546
|
+
};
|
490
547
|
}
|
491
548
|
|
492
549
|
return ResultsNode;
|
@@ -543,3 +600,37 @@ jasmineRequire.QueryString = function() {
|
|
543
600
|
|
544
601
|
return QueryString;
|
545
602
|
};
|
603
|
+
|
604
|
+
jasmineRequire.toHaveClass = function(j$) {
|
605
|
+
/**
|
606
|
+
* {@link expect} the actual value to be a DOM element that has the expected class
|
607
|
+
* @function
|
608
|
+
* @name matchers#toHaveClass
|
609
|
+
* @param {Object} expected - The class name to test for
|
610
|
+
* @example
|
611
|
+
* var el = document.createElement('div');
|
612
|
+
* el.className = 'foo bar baz';
|
613
|
+
* expect(el).toHaveClass('bar');
|
614
|
+
*/
|
615
|
+
function toHaveClass(util, customEqualityTesters) {
|
616
|
+
return {
|
617
|
+
compare: function(actual, expected) {
|
618
|
+
if (!isElement(actual)) {
|
619
|
+
throw new Error(j$.pp(actual) + ' is not a DOM element');
|
620
|
+
}
|
621
|
+
|
622
|
+
return {
|
623
|
+
pass: actual.classList.contains(expected)
|
624
|
+
};
|
625
|
+
}
|
626
|
+
};
|
627
|
+
}
|
628
|
+
|
629
|
+
function isElement(maybeEl) {
|
630
|
+
return maybeEl &&
|
631
|
+
maybeEl.classList &&
|
632
|
+
j$.isFunction_(maybeEl.classList.contains);
|
633
|
+
}
|
634
|
+
|
635
|
+
return toHaveClass;
|
636
|
+
};
|