jasmine-core 2.9.1 → 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/jasmine-core/jasmine-html.js +24 -1
- data/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine-core/jasmine.js +47 -5
- data/lib/jasmine-core/spec/core/SpecSpec.js +1 -0
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +43 -0
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +41 -0
- data/lib/jasmine-core/version.rb +1 -1
- metadata +2 -2
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
|
@@ -88,7 +88,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
88
88
|
results = [],
|
89
89
|
htmlReporterMain,
|
90
90
|
symbols,
|
91
|
-
failedSuites = []
|
91
|
+
failedSuites = [],
|
92
|
+
deprecationWarnings = [];
|
92
93
|
|
93
94
|
this.initialize = function() {
|
94
95
|
clearPrior();
|
@@ -126,6 +127,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
126
127
|
}
|
127
128
|
|
128
129
|
stateBuilder.suiteDone(result);
|
130
|
+
addDeprecationWarnings(result);
|
129
131
|
};
|
130
132
|
|
131
133
|
this.specStarted = function(result) {
|
@@ -169,6 +171,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
169
171
|
|
170
172
|
failures.push(failure);
|
171
173
|
}
|
174
|
+
|
175
|
+
addDeprecationWarnings(result);
|
172
176
|
};
|
173
177
|
|
174
178
|
this.jasmineDone = function(doneResult) {
|
@@ -278,6 +282,14 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
278
282
|
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
|
279
283
|
}
|
280
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
|
+
|
281
293
|
var results = find('.jasmine-results');
|
282
294
|
results.appendChild(summary);
|
283
295
|
|
@@ -352,6 +364,17 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
352
364
|
|
353
365
|
return this;
|
354
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
|
+
|
355
378
|
function find(selector) {
|
356
379
|
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
357
380
|
}
|
@@ -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; }
|
data/lib/jasmine-core/jasmine.js
CHANGED
@@ -505,6 +505,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
505
505
|
* @property {String} fullName - The full description including all ancestors of this spec.
|
506
506
|
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
|
507
507
|
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
|
508
|
+
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
|
508
509
|
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
|
509
510
|
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
510
511
|
*/
|
@@ -514,6 +515,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
514
515
|
fullName: this.getFullName(),
|
515
516
|
failedExpectations: [],
|
516
517
|
passedExpectations: [],
|
518
|
+
deprecationWarnings: [],
|
517
519
|
pendingReason: ''
|
518
520
|
};
|
519
521
|
}
|
@@ -629,6 +631,10 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
629
631
|
return this.getSpecName(this);
|
630
632
|
};
|
631
633
|
|
634
|
+
Spec.prototype.addDeprecationWarning = function(msg) {
|
635
|
+
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
|
636
|
+
};
|
637
|
+
|
632
638
|
var extractCustomPendingMessage = function(e) {
|
633
639
|
var fullMessage = e.toString(),
|
634
640
|
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
|
@@ -710,6 +716,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|
710
716
|
var self = this;
|
711
717
|
var global = options.global || j$.getGlobal();
|
712
718
|
|
719
|
+
var hasExecuted = false;
|
720
|
+
|
713
721
|
var totalSpecsDefined = 0;
|
714
722
|
|
715
723
|
var catchExceptions = true;
|
@@ -895,6 +903,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|
895
903
|
|
896
904
|
// TODO: fix this naming, and here's where the value comes in
|
897
905
|
this.catchExceptions = function(value) {
|
906
|
+
this.deprecated('The catchExceptions option is deprecated and will be replaced with stopOnSpecFailure in Jasmine 3.0');
|
898
907
|
catchExceptions = !!value;
|
899
908
|
return catchExceptions;
|
900
909
|
};
|
@@ -933,6 +942,14 @@ getJasmineRequireObj().Env = function(j$) {
|
|
933
942
|
return seed;
|
934
943
|
};
|
935
944
|
|
945
|
+
this.deprecated = function(msg) {
|
946
|
+
var runnable = currentRunnable() || topSuite;
|
947
|
+
runnable.addDeprecationWarning(msg);
|
948
|
+
if(typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
|
949
|
+
console.error('DEPRECATION: ' + msg);
|
950
|
+
}
|
951
|
+
};
|
952
|
+
|
936
953
|
var queueRunnerFactory = function(options) {
|
937
954
|
options.catchException = catchException;
|
938
955
|
options.clearStack = options.clearStack || clearStack;
|
@@ -940,6 +957,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|
940
957
|
options.fail = self.fail;
|
941
958
|
options.globalErrors = globalErrors;
|
942
959
|
options.completeOnFirstError = throwOnExpectationFailure && options.isLeaf;
|
960
|
+
options.deprecated = self.deprecated;
|
943
961
|
|
944
962
|
new j$.QueueRunner(options).execute();
|
945
963
|
};
|
@@ -959,6 +977,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|
959
977
|
};
|
960
978
|
|
961
979
|
this.execute = function(runnablesToRun) {
|
980
|
+
if (hasExecuted) {
|
981
|
+
this.deprecated('Executing the same Jasmine multiple times will no longer work in Jasmine 3.0');
|
982
|
+
}
|
983
|
+
|
984
|
+
hasExecuted = true;
|
985
|
+
|
962
986
|
if(!runnablesToRun) {
|
963
987
|
if (focusedRunnables.length) {
|
964
988
|
runnablesToRun = focusedRunnables;
|
@@ -1025,10 +1049,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|
1025
1049
|
* @typedef JasmineDoneInfo
|
1026
1050
|
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
1027
1051
|
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
1052
|
+
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
|
1028
1053
|
*/
|
1029
1054
|
reporter.jasmineDone({
|
1030
1055
|
order: order,
|
1031
|
-
failedExpectations: topSuite.result.failedExpectations
|
1056
|
+
failedExpectations: topSuite.result.failedExpectations,
|
1057
|
+
deprecationWarnings: topSuite.result.deprecationWarnings
|
1032
1058
|
});
|
1033
1059
|
});
|
1034
1060
|
};
|
@@ -1130,6 +1156,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|
1130
1156
|
var focusedRunnables = [];
|
1131
1157
|
|
1132
1158
|
this.fdescribe = function(description, specDefinitions) {
|
1159
|
+
this.deprecated('fit and fdescribe will cause your suite to report an \'incomplete\' status in Jasmine 3.0');
|
1133
1160
|
ensureIsNotNested('fdescribe');
|
1134
1161
|
ensureIsFunction(specDefinitions, 'fdescribe');
|
1135
1162
|
var suite = suiteFactory(description);
|
@@ -1255,6 +1282,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|
1255
1282
|
};
|
1256
1283
|
|
1257
1284
|
this.fit = function(description, fn, timeout){
|
1285
|
+
this.deprecated('fit and fdescribe will cause your suite to report an \'incomplete\' status in Jasmine 3.0');
|
1258
1286
|
ensureIsNotNested('fit');
|
1259
1287
|
ensureIsFunctionOrAsync(fn, 'fit');
|
1260
1288
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
@@ -1510,6 +1538,9 @@ getJasmineRequireObj().Any = function(j$) {
|
|
1510
1538
|
}
|
1511
1539
|
|
1512
1540
|
if (this.expectedObject == Object) {
|
1541
|
+
if (other === null) {
|
1542
|
+
j$.getEnv().deprecated('jasmine.Any(Object) will no longer match null in Jasmine 3.0');
|
1543
|
+
}
|
1513
1544
|
return typeof other == 'object';
|
1514
1545
|
}
|
1515
1546
|
|
@@ -4320,7 +4351,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|
4320
4351
|
return function() {
|
4321
4352
|
if (!called) {
|
4322
4353
|
called = true;
|
4323
|
-
fn();
|
4354
|
+
fn.apply(null, arguments);
|
4324
4355
|
}
|
4325
4356
|
return null;
|
4326
4357
|
};
|
@@ -4339,6 +4370,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|
4339
4370
|
this.fail = attrs.fail || function() {};
|
4340
4371
|
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
4341
4372
|
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
4373
|
+
this.deprecated = attrs.deprecated;
|
4342
4374
|
}
|
4343
4375
|
|
4344
4376
|
QueueRunner.prototype.execute = function() {
|
@@ -4398,9 +4430,13 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|
4398
4430
|
clearTimeout(timeoutId);
|
4399
4431
|
self.globalErrors.popListener(handleError);
|
4400
4432
|
}),
|
4401
|
-
next = once(function () {
|
4433
|
+
next = once(function (err) {
|
4402
4434
|
cleanup();
|
4403
4435
|
|
4436
|
+
if (err instanceof Error) {
|
4437
|
+
self.deprecated('done callback received an Error object. Jasmine 3.0 will treat this as a failure');
|
4438
|
+
}
|
4439
|
+
|
4404
4440
|
function runNext() {
|
4405
4441
|
if (self.completeOnFirstError && errored) {
|
4406
4442
|
self.skipToCleanup(iterativeIndex);
|
@@ -5147,13 +5183,15 @@ getJasmineRequireObj().Suite = function(j$) {
|
|
5147
5183
|
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
5148
5184
|
* @property {String} fullName - The full description including all ancestors of this suite.
|
5149
5185
|
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
5186
|
+
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
5150
5187
|
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
5151
5188
|
*/
|
5152
5189
|
this.result = {
|
5153
5190
|
id: this.id,
|
5154
5191
|
description: this.description,
|
5155
5192
|
fullName: this.getFullName(),
|
5156
|
-
failedExpectations: []
|
5193
|
+
failedExpectations: [],
|
5194
|
+
deprecationWarnings: []
|
5157
5195
|
};
|
5158
5196
|
}
|
5159
5197
|
|
@@ -5273,6 +5311,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|
5273
5311
|
}
|
5274
5312
|
};
|
5275
5313
|
|
5314
|
+
Suite.prototype.addDeprecationWarning = function(msg) {
|
5315
|
+
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
|
5316
|
+
};
|
5317
|
+
|
5276
5318
|
function isAfterAll(children) {
|
5277
5319
|
return children && children[0].result.status;
|
5278
5320
|
}
|
@@ -5538,5 +5580,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
|
5538
5580
|
};
|
5539
5581
|
|
5540
5582
|
getJasmineRequireObj().version = function() {
|
5541
|
-
return '2.
|
5583
|
+
return '2.99.0';
|
5542
5584
|
};
|
@@ -2004,4 +2004,47 @@ describe("Env integration", function() {
|
|
2004
2004
|
|
2005
2005
|
env.execute();
|
2006
2006
|
});
|
2007
|
+
|
2008
|
+
it('should report deprecation warnings on the correct specs and suites', function(done) {
|
2009
|
+
var env = new jasmineUnderTest.Env(),
|
2010
|
+
reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']);
|
2011
|
+
|
2012
|
+
reporter.jasmineDone.and.callFake(function(result) {
|
2013
|
+
expect(result.deprecationWarnings).toEqual([
|
2014
|
+
jasmine.objectContaining({ message: 'top level deprecation' })
|
2015
|
+
]);
|
2016
|
+
|
2017
|
+
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
2018
|
+
fullName: 'suite',
|
2019
|
+
deprecationWarnings: [
|
2020
|
+
jasmine.objectContaining({ message: 'suite level deprecation' })
|
2021
|
+
]
|
2022
|
+
}));
|
2023
|
+
|
2024
|
+
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
2025
|
+
fullName: 'suite spec',
|
2026
|
+
deprecationWarnings: [
|
2027
|
+
jasmine.objectContaining({ message: 'spec level deprecation' })
|
2028
|
+
]
|
2029
|
+
}));
|
2030
|
+
|
2031
|
+
done();
|
2032
|
+
});
|
2033
|
+
|
2034
|
+
env.addReporter(reporter);
|
2035
|
+
|
2036
|
+
env.deprecated('top level deprecation');
|
2037
|
+
|
2038
|
+
env.describe('suite', function() {
|
2039
|
+
env.beforeAll(function() {
|
2040
|
+
env.deprecated('suite level deprecation');
|
2041
|
+
});
|
2042
|
+
|
2043
|
+
env.it('spec', function() {
|
2044
|
+
env.deprecated('spec level deprecation');
|
2045
|
+
});
|
2046
|
+
});
|
2047
|
+
|
2048
|
+
env.execute();
|
2049
|
+
});
|
2007
2050
|
});
|
@@ -208,6 +208,47 @@ describe("New HtmlReporter", function() {
|
|
208
208
|
});
|
209
209
|
});
|
210
210
|
|
211
|
+
describe('when there are deprecation warnings', function() {
|
212
|
+
it('displays the messages in their own alert bars', function() {
|
213
|
+
var env = new jasmineUnderTest.Env(),
|
214
|
+
container = document.createElement('div'),
|
215
|
+
getContainer = function() { return container; },
|
216
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
217
|
+
env: env,
|
218
|
+
getContainer: getContainer,
|
219
|
+
createElement: function() { return document.createElement.apply(document, arguments); },
|
220
|
+
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
221
|
+
});
|
222
|
+
|
223
|
+
reporter.initialize();
|
224
|
+
|
225
|
+
reporter.jasmineStarted({});
|
226
|
+
reporter.specDone({
|
227
|
+
status: 'passed',
|
228
|
+
deprecationWarnings: [{ message: 'spec deprecation' }],
|
229
|
+
failedExpectations: [],
|
230
|
+
passedExpectations: []
|
231
|
+
});
|
232
|
+
reporter.suiteDone({
|
233
|
+
status: 'passed',
|
234
|
+
deprecationWarnings: [{ message: 'suite deprecation' }],
|
235
|
+
failedExpectations: []
|
236
|
+
});
|
237
|
+
reporter.jasmineDone({
|
238
|
+
deprecationWarnings: [{ message: 'global deprecation' }],
|
239
|
+
failedExpectations: []
|
240
|
+
});
|
241
|
+
|
242
|
+
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
243
|
+
|
244
|
+
expect(alertBars.length).toEqual(4);
|
245
|
+
expect(alertBars[1].innerHTML).toMatch(/spec deprecation/);
|
246
|
+
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-warning');
|
247
|
+
expect(alertBars[2].innerHTML).toMatch(/suite deprecation/);
|
248
|
+
expect(alertBars[3].innerHTML).toMatch(/global deprecation/);
|
249
|
+
});
|
250
|
+
});
|
251
|
+
|
211
252
|
describe("when Jasmine is done", function() {
|
212
253
|
it("adds a warning to the link title of specs that have no expectations", function() {
|
213
254
|
if (!window.console) {
|
data/lib/jasmine-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.99.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Van Hove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|