jasmine-core 2.7.0 → 2.8.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.
- package/CODE_OF_CONDUCT.md +46 -0
- package/jasmine_core.egg-info/PKG-INFO +1 -1
- package/lib/jasmine-core/jasmine.js +287 -43
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
+
|
|
11
|
+
* Using welcoming and inclusive language
|
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
|
13
|
+
* Gracefully accepting constructive criticism
|
|
14
|
+
* Focusing on what is best for the community
|
|
15
|
+
* Showing empathy towards other community members
|
|
16
|
+
|
|
17
|
+
Examples of unacceptable behavior by participants include:
|
|
18
|
+
|
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
21
|
+
* Public or private harassment
|
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
24
|
+
|
|
25
|
+
## Our Responsibilities
|
|
26
|
+
|
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
28
|
+
|
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jasmine-maintainers@googlegroups.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
38
|
+
|
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
44
|
+
|
|
45
|
+
[homepage]: http://contributor-covenant.org
|
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: jasmine-core
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Summary: Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, Node.js (http://nodejs.org) projects, or anywhere that JavaScript can run.
|
|
5
5
|
Home-page: http://jasmine.github.io
|
|
6
6
|
Author: Pivotal Labs
|
|
@@ -63,6 +63,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|
|
63
63
|
j$.matchersUtil = jRequire.matchersUtil(j$);
|
|
64
64
|
j$.ObjectContaining = jRequire.ObjectContaining(j$);
|
|
65
65
|
j$.ArrayContaining = jRequire.ArrayContaining(j$);
|
|
66
|
+
j$.ArrayWithExactContents = jRequire.ArrayWithExactContents(j$);
|
|
66
67
|
j$.pp = jRequire.pp(j$);
|
|
67
68
|
j$.QueueRunner = jRequire.QueueRunner(j$);
|
|
68
69
|
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
|
@@ -92,6 +93,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
|
|
|
92
93
|
|
|
93
94
|
getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|
94
95
|
var availableMatchers = [
|
|
96
|
+
'nothing',
|
|
95
97
|
'toBe',
|
|
96
98
|
'toBeCloseTo',
|
|
97
99
|
'toBeDefined',
|
|
@@ -191,6 +193,18 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|
|
191
193
|
return j$.isA_('AsyncFunction', value);
|
|
192
194
|
};
|
|
193
195
|
|
|
196
|
+
j$.isTypedArray_ = function(value) {
|
|
197
|
+
return j$.isA_('Float32Array', value) ||
|
|
198
|
+
j$.isA_('Float64Array', value) ||
|
|
199
|
+
j$.isA_('Int16Array', value) ||
|
|
200
|
+
j$.isA_('Int32Array', value) ||
|
|
201
|
+
j$.isA_('Int8Array', value) ||
|
|
202
|
+
j$.isA_('Uint16Array', value) ||
|
|
203
|
+
j$.isA_('Uint32Array', value) ||
|
|
204
|
+
j$.isA_('Uint8Array', value) ||
|
|
205
|
+
j$.isA_('Uint8ClampedArray', value);
|
|
206
|
+
};
|
|
207
|
+
|
|
194
208
|
j$.isA_ = function(typeName, value) {
|
|
195
209
|
return j$.getType_(value) === '[object ' + typeName + ']';
|
|
196
210
|
};
|
|
@@ -208,7 +222,9 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|
|
208
222
|
return func.name;
|
|
209
223
|
}
|
|
210
224
|
|
|
211
|
-
var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/)
|
|
225
|
+
var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/) ||
|
|
226
|
+
func.toString().match(/^\s*\[object\s*(\w*)Constructor\]/);
|
|
227
|
+
|
|
212
228
|
return matches ? matches[1] : '<anonymous>';
|
|
213
229
|
};
|
|
214
230
|
|
|
@@ -266,6 +282,17 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|
|
266
282
|
return new j$.ArrayContaining(sample);
|
|
267
283
|
};
|
|
268
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
|
|
287
|
+
* that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order.
|
|
288
|
+
* @name jasmine.arrayWithExactContents
|
|
289
|
+
* @function
|
|
290
|
+
* @param {Array} sample
|
|
291
|
+
*/
|
|
292
|
+
j$.arrayWithExactContents = function(sample) {
|
|
293
|
+
return new j$.ArrayWithExactContents(sample);
|
|
294
|
+
};
|
|
295
|
+
|
|
269
296
|
/**
|
|
270
297
|
* Create a bare {@link Spy} object. This won't be installed anywhere and will not have any implementation behind it.
|
|
271
298
|
* @name jasmine.createSpy
|
|
@@ -436,6 +463,16 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
|
436
463
|
this.pend();
|
|
437
464
|
}
|
|
438
465
|
|
|
466
|
+
/**
|
|
467
|
+
* @typedef SpecResult
|
|
468
|
+
* @property {Int} id - The unique id of this spec.
|
|
469
|
+
* @property {String} description - The description passed to the {@link it} that created this spec.
|
|
470
|
+
* @property {String} fullName - The full description including all ancestors of this spec.
|
|
471
|
+
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
|
|
472
|
+
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
|
|
473
|
+
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
|
|
474
|
+
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
|
|
475
|
+
*/
|
|
439
476
|
this.result = {
|
|
440
477
|
id: this.id,
|
|
441
478
|
description: this.description,
|
|
@@ -664,12 +701,56 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
664
701
|
return currentSpec || currentSuite();
|
|
665
702
|
};
|
|
666
703
|
|
|
704
|
+
/**
|
|
705
|
+
* This represents the available reporter callback for an object passed to {@link Env#addReporter}.
|
|
706
|
+
* @interface Reporter
|
|
707
|
+
*/
|
|
667
708
|
var reporter = new j$.ReportDispatcher([
|
|
709
|
+
/**
|
|
710
|
+
* `jasmineStarted` is called after all of the specs have been loaded, but just before execution starts.
|
|
711
|
+
* @function
|
|
712
|
+
* @name Reporter#jasmineStarted
|
|
713
|
+
* @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run
|
|
714
|
+
*/
|
|
668
715
|
'jasmineStarted',
|
|
716
|
+
/**
|
|
717
|
+
* When the entire suite has finished execution `jasmineDone` is called
|
|
718
|
+
* @function
|
|
719
|
+
* @name Reporter#jasmineDone
|
|
720
|
+
* @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running.
|
|
721
|
+
*/
|
|
669
722
|
'jasmineDone',
|
|
723
|
+
/**
|
|
724
|
+
* `suiteStarted` is invoked when a `describe` starts to run
|
|
725
|
+
* @function
|
|
726
|
+
* @name Reporter#suiteStarted
|
|
727
|
+
* @param {SuiteResult} result Information about the individual {@link describe} being run
|
|
728
|
+
*/
|
|
670
729
|
'suiteStarted',
|
|
730
|
+
/**
|
|
731
|
+
* `suiteDone` is invoked when all of the child specs and suites for a given suite have been run
|
|
732
|
+
*
|
|
733
|
+
* While jasmine doesn't require any specific functions, not defining a `suiteDone` will make it impossible for a reporter to know when a suite has failures in an `afterAll`.
|
|
734
|
+
* @function
|
|
735
|
+
* @name Reporter#suiteDone
|
|
736
|
+
* @param {SuiteResult} result
|
|
737
|
+
*/
|
|
671
738
|
'suiteDone',
|
|
739
|
+
/**
|
|
740
|
+
* `specStarted` is invoked when an `it` starts to run (including associated `beforeEach` functions)
|
|
741
|
+
* @function
|
|
742
|
+
* @name Reporter#specStarted
|
|
743
|
+
* @param {SpecResult} result Information about the individual {@link it} being run
|
|
744
|
+
*/
|
|
672
745
|
'specStarted',
|
|
746
|
+
/**
|
|
747
|
+
* `specDone` is invoked when an `it` and its associated `beforeEach` and `afterEach` functions have been run.
|
|
748
|
+
*
|
|
749
|
+
* While jasmine doesn't require any specific functions, not defining a `specDone` will make it impossible for a reporter to know when a spec has failed.
|
|
750
|
+
* @function
|
|
751
|
+
* @name Reporter#specDone
|
|
752
|
+
* @param {SpecResult} result
|
|
753
|
+
*/
|
|
673
754
|
'specDone'
|
|
674
755
|
]);
|
|
675
756
|
|
|
@@ -885,6 +966,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
885
966
|
throw new Error('Invalid order: would cause a beforeAll or afterAll to be run multiple times');
|
|
886
967
|
}
|
|
887
968
|
|
|
969
|
+
/**
|
|
970
|
+
* Information passed to the {@link Reporter#jasmineStarted} event.
|
|
971
|
+
* @typedef JasmineStartedInfo
|
|
972
|
+
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
|
|
973
|
+
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
|
974
|
+
*/
|
|
888
975
|
reporter.jasmineStarted({
|
|
889
976
|
totalSpecsDefined: totalSpecsDefined,
|
|
890
977
|
order: order
|
|
@@ -898,6 +985,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
898
985
|
currentlyExecutingSuites.pop();
|
|
899
986
|
globalErrors.uninstall();
|
|
900
987
|
|
|
988
|
+
/**
|
|
989
|
+
* Information passed to the {@link Reporter#jasmineDone} event.
|
|
990
|
+
* @typedef JasmineDoneInfo
|
|
991
|
+
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
|
|
992
|
+
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
|
|
993
|
+
*/
|
|
901
994
|
reporter.jasmineDone({
|
|
902
995
|
order: order,
|
|
903
996
|
failedExpectations: topSuite.result.failedExpectations
|
|
@@ -909,6 +1002,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
909
1002
|
* Add a custom reporter to the Jasmine environment.
|
|
910
1003
|
* @name Env#addReporter
|
|
911
1004
|
* @function
|
|
1005
|
+
* @param {Reporter} reporterToAdd The reporter to be added.
|
|
912
1006
|
* @see custom_reporter
|
|
913
1007
|
*/
|
|
914
1008
|
this.addReporter = function(reporterToAdd) {
|
|
@@ -1215,11 +1309,10 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
|
1215
1309
|
};
|
|
1216
1310
|
|
|
1217
1311
|
/**
|
|
1218
|
-
* _Note:_ Do not construct this directly, use the global `jsApiReporter` to retrieve the instantiated object.
|
|
1219
|
-
*
|
|
1220
1312
|
* @name jsApiReporter
|
|
1221
|
-
* @classdesc Reporter added by default in `boot.js` to record results for retrieval in javascript code.
|
|
1313
|
+
* @classdesc {@link Reporter} added by default in `boot.js` to record results for retrieval in javascript code. An instance is made available as `jsApiReporter` on the global object.
|
|
1222
1314
|
* @class
|
|
1315
|
+
* @hideconstructor
|
|
1223
1316
|
*/
|
|
1224
1317
|
function JsApiReporter(options) {
|
|
1225
1318
|
var timer = options.timer || noopTimer,
|
|
@@ -1273,7 +1366,7 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
|
1273
1366
|
* @function
|
|
1274
1367
|
* @param {Number} index - The position in the suites list to start from.
|
|
1275
1368
|
* @param {Number} length - Maximum number of suite results to return.
|
|
1276
|
-
* @return {
|
|
1369
|
+
* @return {SuiteResult[]}
|
|
1277
1370
|
*/
|
|
1278
1371
|
this.suiteResults = function(index, length) {
|
|
1279
1372
|
return suites.slice(index, index + length);
|
|
@@ -1288,7 +1381,7 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
|
1288
1381
|
* Get all of the suites in a single object, with their `id` as the key.
|
|
1289
1382
|
* @name jsApiReporter#suites
|
|
1290
1383
|
* @function
|
|
1291
|
-
* @return {Object}
|
|
1384
|
+
* @return {Object} - Map of suite id to {@link SuiteResult}
|
|
1292
1385
|
*/
|
|
1293
1386
|
this.suites = function() {
|
|
1294
1387
|
return suites_hash;
|
|
@@ -1308,7 +1401,7 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
|
1308
1401
|
* @function
|
|
1309
1402
|
* @param {Number} index - The position in the specs list to start from.
|
|
1310
1403
|
* @param {Number} length - Maximum number of specs results to return.
|
|
1311
|
-
* @return {
|
|
1404
|
+
* @return {SpecResult[]}
|
|
1312
1405
|
*/
|
|
1313
1406
|
this.specResults = function(index, length) {
|
|
1314
1407
|
return specs.slice(index, index + length);
|
|
@@ -1318,7 +1411,7 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
|
1318
1411
|
* Get all spec results.
|
|
1319
1412
|
* @name jsApiReporter#specs
|
|
1320
1413
|
* @function
|
|
1321
|
-
* @return {
|
|
1414
|
+
* @return {SpecResult[]}
|
|
1322
1415
|
*/
|
|
1323
1416
|
this.specs = function() {
|
|
1324
1417
|
return specs;
|
|
@@ -1403,8 +1496,9 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
|
|
1403
1496
|
}
|
|
1404
1497
|
|
|
1405
1498
|
ArrayContaining.prototype.asymmetricMatch = function(other, customTesters) {
|
|
1406
|
-
|
|
1407
|
-
|
|
1499
|
+
if (!j$.isArray_(this.sample)) {
|
|
1500
|
+
throw new Error('You must provide an array to arrayContaining, not ' + j$.pp(this.sample) + '.');
|
|
1501
|
+
}
|
|
1408
1502
|
|
|
1409
1503
|
for (var i = 0; i < this.sample.length; i++) {
|
|
1410
1504
|
var item = this.sample[i];
|
|
@@ -1423,6 +1517,38 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
|
|
1423
1517
|
return ArrayContaining;
|
|
1424
1518
|
};
|
|
1425
1519
|
|
|
1520
|
+
getJasmineRequireObj().ArrayWithExactContents = function(j$) {
|
|
1521
|
+
|
|
1522
|
+
function ArrayWithExactContents(sample) {
|
|
1523
|
+
this.sample = sample;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
ArrayWithExactContents.prototype.asymmetricMatch = function(other, customTesters) {
|
|
1527
|
+
if (!j$.isArray_(this.sample)) {
|
|
1528
|
+
throw new Error('You must provide an array to arrayWithExactContents, not ' + j$.pp(this.sample) + '.');
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
if (this.sample.length !== other.length) {
|
|
1532
|
+
return false;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
for (var i = 0; i < this.sample.length; i++) {
|
|
1536
|
+
var item = this.sample[i];
|
|
1537
|
+
if (!j$.matchersUtil.contains(other, item, customTesters)) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
return true;
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
ArrayWithExactContents.prototype.jasmineToString = function() {
|
|
1546
|
+
return '<jasmine.arrayWithExactContents ' + j$.pp(this.sample) + '>';
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1549
|
+
return ArrayWithExactContents;
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1426
1552
|
getJasmineRequireObj().ObjectContaining = function(j$) {
|
|
1427
1553
|
|
|
1428
1554
|
function ObjectContaining(sample) {
|
|
@@ -1507,10 +1633,13 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
|
|
1507
1633
|
var clonedArgs = [];
|
|
1508
1634
|
var argsAsArray = j$.util.argsToArray(context.args);
|
|
1509
1635
|
for(var i = 0; i < argsAsArray.length; i++) {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1636
|
+
var str = Object.prototype.toString.apply(argsAsArray[i]),
|
|
1637
|
+
primitives = /^\[object (Boolean|String|RegExp|Number)/;
|
|
1638
|
+
|
|
1639
|
+
if (argsAsArray[i] == null || str.match(primitives)) {
|
|
1513
1640
|
clonedArgs.push(argsAsArray[i]);
|
|
1641
|
+
} else {
|
|
1642
|
+
clonedArgs.push(j$.util.clone(argsAsArray[i]));
|
|
1514
1643
|
}
|
|
1515
1644
|
}
|
|
1516
1645
|
context.args = clonedArgs;
|
|
@@ -2164,6 +2293,15 @@ getJasmineRequireObj().buildExpectationResult = function() {
|
|
|
2164
2293
|
var messageFormatter = options.messageFormatter || function() {},
|
|
2165
2294
|
stackFormatter = options.stackFormatter || function() {};
|
|
2166
2295
|
|
|
2296
|
+
/**
|
|
2297
|
+
* @typedef Expectation
|
|
2298
|
+
* @property {String} matcherName - The name of the matcher that was executed for this expectation.
|
|
2299
|
+
* @property {String} message - The failure message for the expectation.
|
|
2300
|
+
* @property {String} stack - The stack trace for the failure if available.
|
|
2301
|
+
* @property {Boolean} passed - Whether the expectation passed or failed.
|
|
2302
|
+
* @property {Object} expected - If the expectation failed, what was the expected value.
|
|
2303
|
+
* @property {Object} actual - If the expectation failed, what actual value was produced.
|
|
2304
|
+
*/
|
|
2167
2305
|
var result = {
|
|
2168
2306
|
matcherName: options.matcherName,
|
|
2169
2307
|
message: message(),
|
|
@@ -2374,13 +2512,17 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
|
2374
2512
|
|
|
2375
2513
|
if (asymmetricA) {
|
|
2376
2514
|
result = a.asymmetricMatch(b, customTesters);
|
|
2377
|
-
|
|
2515
|
+
if (!result) {
|
|
2516
|
+
diffBuilder.record(a, b);
|
|
2517
|
+
}
|
|
2378
2518
|
return result;
|
|
2379
2519
|
}
|
|
2380
2520
|
|
|
2381
2521
|
if (asymmetricB) {
|
|
2382
2522
|
result = b.asymmetricMatch(a, customTesters);
|
|
2383
|
-
|
|
2523
|
+
if (!result) {
|
|
2524
|
+
diffBuilder.record(a, b);
|
|
2525
|
+
}
|
|
2384
2526
|
return result;
|
|
2385
2527
|
}
|
|
2386
2528
|
}
|
|
@@ -2533,35 +2675,84 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
|
2533
2675
|
// Recursively compare objects and arrays.
|
|
2534
2676
|
// Compare array lengths to determine if a deep comparison is necessary.
|
|
2535
2677
|
if (className == '[object Array]') {
|
|
2536
|
-
|
|
2537
|
-
|
|
2678
|
+
var aLength = a.length;
|
|
2679
|
+
var bLength = b.length;
|
|
2680
|
+
|
|
2681
|
+
diffBuilder.withPath('length', function() {
|
|
2682
|
+
if (aLength !== bLength) {
|
|
2683
|
+
diffBuilder.record(aLength, bLength);
|
|
2684
|
+
result = false;
|
|
2685
|
+
}
|
|
2686
|
+
});
|
|
2687
|
+
|
|
2688
|
+
for (i = 0; i < aLength || i < bLength; i++) {
|
|
2689
|
+
diffBuilder.withPath(i, function() {
|
|
2690
|
+
result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack, customTesters, diffBuilder) && result;
|
|
2691
|
+
});
|
|
2692
|
+
}
|
|
2693
|
+
if (!result) {
|
|
2694
|
+
return false;
|
|
2695
|
+
}
|
|
2696
|
+
} else if (className == '[object Map]') {
|
|
2697
|
+
if (a.size != b.size) {
|
|
2538
2698
|
diffBuilder.record(a, b);
|
|
2539
2699
|
return false;
|
|
2540
2700
|
}
|
|
2541
2701
|
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2702
|
+
// For both sets of keys, check they map to equal values in both maps
|
|
2703
|
+
var mapKeys = [a.keys(), b.keys()];
|
|
2704
|
+
var mapIter, mapKeyIt, mapKey;
|
|
2705
|
+
for (i = 0; result && i < mapKeys.length; i++) {
|
|
2706
|
+
mapIter = mapKeys[i];
|
|
2707
|
+
mapKeyIt = mapIter.next();
|
|
2708
|
+
while (result && !mapKeyIt.done) {
|
|
2709
|
+
mapKey = mapKeyIt.value;
|
|
2710
|
+
result = eq(a.get(mapKey), b.get(mapKey), aStack, bStack, customTesters, j$.NullDiffBuilder());
|
|
2711
|
+
mapKeyIt = mapIter.next();
|
|
2712
|
+
}
|
|
2546
2713
|
}
|
|
2714
|
+
|
|
2547
2715
|
if (!result) {
|
|
2716
|
+
diffBuilder.record(a, b);
|
|
2548
2717
|
return false;
|
|
2549
2718
|
}
|
|
2550
|
-
} else if (className == '[object Set]'
|
|
2719
|
+
} else if (className == '[object Set]') {
|
|
2551
2720
|
if (a.size != b.size) {
|
|
2552
2721
|
diffBuilder.record(a, b);
|
|
2553
2722
|
return false;
|
|
2554
2723
|
}
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2724
|
+
|
|
2725
|
+
// For both sets, check they are all contained in the other set
|
|
2726
|
+
var setPairs = [[a, b], [b, a]];
|
|
2727
|
+
var baseIter, baseValueIt, baseValue;
|
|
2728
|
+
var otherSet, otherIter, otherValueIt, otherValue, found;
|
|
2729
|
+
for (i = 0; result && i < setPairs.length; i++) {
|
|
2730
|
+
baseIter = setPairs[i][0].values();
|
|
2731
|
+
otherSet = setPairs[i][1];
|
|
2732
|
+
// For each value in the base set...
|
|
2733
|
+
baseValueIt = baseIter.next();
|
|
2734
|
+
while (result && !baseValueIt.done) {
|
|
2735
|
+
baseValue = baseValueIt.value;
|
|
2736
|
+
// ... test that it is present in the other set
|
|
2737
|
+
otherIter = otherSet.values();
|
|
2738
|
+
otherValueIt = otherIter.next();
|
|
2739
|
+
// Optimisation: start looking for value by object identity
|
|
2740
|
+
found = otherSet.has(baseValue);
|
|
2741
|
+
// If not found, compare by value equality
|
|
2742
|
+
while (!found && !otherValueIt.done) {
|
|
2743
|
+
otherValue = otherValueIt.value;
|
|
2744
|
+
found = eq(baseValue, otherValue, aStack, bStack, customTesters, j$.NullDiffBuilder());
|
|
2745
|
+
otherValueIt = otherIter.next();
|
|
2746
|
+
}
|
|
2747
|
+
result = result && found;
|
|
2748
|
+
baseValueIt = baseIter.next();
|
|
2563
2749
|
}
|
|
2564
|
-
}
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
if (!result) {
|
|
2753
|
+
diffBuilder.record(a, b);
|
|
2754
|
+
return false;
|
|
2755
|
+
}
|
|
2565
2756
|
} else {
|
|
2566
2757
|
|
|
2567
2758
|
// Objects with different constructors are not equivalent, but `Object`s
|
|
@@ -2694,6 +2885,27 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
|
2694
2885
|
}
|
|
2695
2886
|
};
|
|
2696
2887
|
|
|
2888
|
+
getJasmineRequireObj().nothing = function() {
|
|
2889
|
+
/**
|
|
2890
|
+
* {@link expect} nothing explicitly.
|
|
2891
|
+
* @function
|
|
2892
|
+
* @name matchers#nothing
|
|
2893
|
+
* @example
|
|
2894
|
+
* expect().nothing();
|
|
2895
|
+
*/
|
|
2896
|
+
function nothing() {
|
|
2897
|
+
return {
|
|
2898
|
+
compare: function() {
|
|
2899
|
+
return {
|
|
2900
|
+
pass: true
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
return nothing;
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2697
2909
|
getJasmineRequireObj().NullDiffBuilder = function(j$) {
|
|
2698
2910
|
return function() {
|
|
2699
2911
|
return {
|
|
@@ -3716,6 +3928,8 @@ getJasmineRequireObj().pp = function(j$) {
|
|
|
3716
3928
|
this.emitSet(value);
|
|
3717
3929
|
} else if (j$.getType_(value) == '[object Map]') {
|
|
3718
3930
|
this.emitMap(value);
|
|
3931
|
+
} else if (j$.isTypedArray_(value)) {
|
|
3932
|
+
this.emitTypedArray(value);
|
|
3719
3933
|
} else if (value.toString && typeof value === 'object' && !j$.isArray_(value) && hasCustomToString(value)) {
|
|
3720
3934
|
this.emitScalar(value.toString());
|
|
3721
3935
|
} else if (j$.util.arrayContains(this.seen, value)) {
|
|
@@ -3886,6 +4100,18 @@ getJasmineRequireObj().pp = function(j$) {
|
|
|
3886
4100
|
this.append(' })');
|
|
3887
4101
|
};
|
|
3888
4102
|
|
|
4103
|
+
StringPrettyPrinter.prototype.emitTypedArray = function(arr) {
|
|
4104
|
+
var constructorName = j$.fnNameFor(arr.constructor),
|
|
4105
|
+
limitedArray = Array.prototype.slice.call(arr, 0, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH),
|
|
4106
|
+
itemsString = Array.prototype.join.call(limitedArray, ', ');
|
|
4107
|
+
|
|
4108
|
+
if (limitedArray.length !== arr.length) {
|
|
4109
|
+
itemsString += ', ...';
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
this.append(constructorName + ' [ ' + itemsString + ' ]');
|
|
4113
|
+
};
|
|
4114
|
+
|
|
3889
4115
|
StringPrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) {
|
|
3890
4116
|
this.append(property);
|
|
3891
4117
|
this.append(': ');
|
|
@@ -4149,6 +4375,16 @@ getJasmineRequireObj().ReportDispatcher = function() {
|
|
|
4149
4375
|
|
|
4150
4376
|
getJasmineRequireObj().interface = function(jasmine, env) {
|
|
4151
4377
|
var jasmineInterface = {
|
|
4378
|
+
/**
|
|
4379
|
+
* Callback passed to parts of the Jasmine base interface.
|
|
4380
|
+
*
|
|
4381
|
+
* By default Jasmine assumes this function completes synchronously.
|
|
4382
|
+
* If you have code that you need to test asynchronously, you can declare that you receive a `done` callback, return a Promise, or use the `async` keyword if it is supported in your environment.
|
|
4383
|
+
* @callback implementationCallback
|
|
4384
|
+
* @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
|
|
4385
|
+
* @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.
|
|
4386
|
+
*/
|
|
4387
|
+
|
|
4152
4388
|
/**
|
|
4153
4389
|
* Create a group of specs (often called a suite).
|
|
4154
4390
|
*
|
|
@@ -4157,7 +4393,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4157
4393
|
* @function
|
|
4158
4394
|
* @global
|
|
4159
4395
|
* @param {String} description Textual description of the group
|
|
4160
|
-
* @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites
|
|
4396
|
+
* @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs
|
|
4161
4397
|
*/
|
|
4162
4398
|
describe: function(description, specDefinitions) {
|
|
4163
4399
|
return env.describe(description, specDefinitions);
|
|
@@ -4171,7 +4407,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4171
4407
|
* @function
|
|
4172
4408
|
* @global
|
|
4173
4409
|
* @param {String} description Textual description of the group
|
|
4174
|
-
* @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites
|
|
4410
|
+
* @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs
|
|
4175
4411
|
*/
|
|
4176
4412
|
xdescribe: function(description, specDefinitions) {
|
|
4177
4413
|
return env.xdescribe(description, specDefinitions);
|
|
@@ -4186,7 +4422,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4186
4422
|
* @function
|
|
4187
4423
|
* @global
|
|
4188
4424
|
* @param {String} description Textual description of the group
|
|
4189
|
-
* @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites
|
|
4425
|
+
* @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs
|
|
4190
4426
|
*/
|
|
4191
4427
|
fdescribe: function(description, specDefinitions) {
|
|
4192
4428
|
return env.fdescribe(description, specDefinitions);
|
|
@@ -4200,7 +4436,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4200
4436
|
* @function
|
|
4201
4437
|
* @global
|
|
4202
4438
|
* @param {String} description Textual description of what this spec is checking
|
|
4203
|
-
* @param {
|
|
4439
|
+
* @param {implementationCallback} [testFunction] Function that contains the code of your test. If not provided the test will be `pending`.
|
|
4204
4440
|
* @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec.
|
|
4205
4441
|
*/
|
|
4206
4442
|
it: function() {
|
|
@@ -4215,7 +4451,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4215
4451
|
* @function
|
|
4216
4452
|
* @global
|
|
4217
4453
|
* @param {String} description Textual description of what this spec is checking.
|
|
4218
|
-
* @param {
|
|
4454
|
+
* @param {implementationCallback} [testFunction] Function that contains the code of your test. Will not be executed.
|
|
4219
4455
|
*/
|
|
4220
4456
|
xit: function() {
|
|
4221
4457
|
return env.xit.apply(env, arguments);
|
|
@@ -4229,7 +4465,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4229
4465
|
* @function
|
|
4230
4466
|
* @global
|
|
4231
4467
|
* @param {String} description Textual description of what this spec is checking.
|
|
4232
|
-
* @param {
|
|
4468
|
+
* @param {implementationCallback} testFunction Function that contains the code of your test.
|
|
4233
4469
|
* @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec.
|
|
4234
4470
|
*/
|
|
4235
4471
|
fit: function() {
|
|
@@ -4241,7 +4477,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4241
4477
|
* @name beforeEach
|
|
4242
4478
|
* @function
|
|
4243
4479
|
* @global
|
|
4244
|
-
* @param {
|
|
4480
|
+
* @param {implementationCallback} [function] Function that contains the code to setup your specs.
|
|
4245
4481
|
* @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeEach.
|
|
4246
4482
|
*/
|
|
4247
4483
|
beforeEach: function() {
|
|
@@ -4253,7 +4489,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4253
4489
|
* @name afterEach
|
|
4254
4490
|
* @function
|
|
4255
4491
|
* @global
|
|
4256
|
-
* @param {
|
|
4492
|
+
* @param {implementationCallback} [function] Function that contains the code to teardown your specs.
|
|
4257
4493
|
* @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterEach.
|
|
4258
4494
|
*/
|
|
4259
4495
|
afterEach: function() {
|
|
@@ -4267,7 +4503,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4267
4503
|
* @name beforeAll
|
|
4268
4504
|
* @function
|
|
4269
4505
|
* @global
|
|
4270
|
-
* @param {
|
|
4506
|
+
* @param {implementationCallback} [function] Function that contains the code to setup your specs.
|
|
4271
4507
|
* @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeAll.
|
|
4272
4508
|
*/
|
|
4273
4509
|
beforeAll: function() {
|
|
@@ -4275,13 +4511,13 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
4275
4511
|
},
|
|
4276
4512
|
|
|
4277
4513
|
/**
|
|
4278
|
-
* Run some shared teardown once
|
|
4514
|
+
* Run some shared teardown once after all of the specs in the {@link describe} are run.
|
|
4279
4515
|
*
|
|
4280
4516
|
* _Note:_ Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.
|
|
4281
4517
|
* @name afterAll
|
|
4282
4518
|
* @function
|
|
4283
4519
|
* @global
|
|
4284
|
-
* @param {
|
|
4520
|
+
* @param {implementationCallback} [function] Function that contains the code to teardown your specs.
|
|
4285
4521
|
* @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterAll.
|
|
4286
4522
|
*/
|
|
4287
4523
|
afterAll: function() {
|
|
@@ -4748,6 +4984,14 @@ getJasmineRequireObj().Suite = function(j$) {
|
|
|
4748
4984
|
|
|
4749
4985
|
this.children = [];
|
|
4750
4986
|
|
|
4987
|
+
/**
|
|
4988
|
+
* @typedef SuiteResult
|
|
4989
|
+
* @property {Int} id - The unique id of this suite.
|
|
4990
|
+
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
|
4991
|
+
* @property {String} fullName - The full description including all ancestors of this suite.
|
|
4992
|
+
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
|
4993
|
+
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
|
4994
|
+
*/
|
|
4751
4995
|
this.result = {
|
|
4752
4996
|
id: this.id,
|
|
4753
4997
|
description: this.description,
|
|
@@ -5137,5 +5381,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
|
|
5137
5381
|
};
|
|
5138
5382
|
|
|
5139
5383
|
getJasmineRequireObj().version = function() {
|
|
5140
|
-
return '2.
|
|
5384
|
+
return '2.8.0';
|
|
5141
5385
|
};
|