jasmine-core 5.12.0 → 5.13.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/README.md +1 -1
- package/lib/jasmine-core/jasmine.js +135 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Microsoft Edge) as well as Node.
|
|
|
30
30
|
| Environment | Supported versions |
|
|
31
31
|
|-------------------|----------------------------------|
|
|
32
32
|
| Node | 18.20.5+*, 20, 22, 24 |
|
|
33
|
-
| Safari | 16*, 17*
|
|
33
|
+
| Safari | 16*, 17*, 26* |
|
|
34
34
|
| Chrome | Evergreen |
|
|
35
35
|
| Firefox | Evergreen, 102*, 115*, 128*, 140 |
|
|
36
36
|
| Edge | Evergreen |
|
|
@@ -59,6 +59,7 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
|
|
59
59
|
j$.util = jRequire.util(j$);
|
|
60
60
|
j$.errors = jRequire.errors();
|
|
61
61
|
j$.formatErrorMsg = jRequire.formatErrorMsg();
|
|
62
|
+
j$.AllOf = jRequire.AllOf(j$);
|
|
62
63
|
j$.Any = jRequire.Any(j$);
|
|
63
64
|
j$.Anything = jRequire.Anything(j$);
|
|
64
65
|
j$.CallTracker = jRequire.CallTracker(j$);
|
|
@@ -416,6 +417,19 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|
|
416
417
|
);
|
|
417
418
|
};
|
|
418
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Get an {@link AsymmetricEqualityTester} that will succeed if the actual
|
|
422
|
+
* value being compared matches every provided equality tester.
|
|
423
|
+
* @name asymmetricEqualityTesters.allOf
|
|
424
|
+
* @emittedName jasmine.allOf
|
|
425
|
+
* @since 5.13.0
|
|
426
|
+
* @function
|
|
427
|
+
* @param {...*} arguments - The asymmetric equality checkers to compare.
|
|
428
|
+
*/
|
|
429
|
+
j$.allOf = function() {
|
|
430
|
+
return new j$.AllOf(...arguments);
|
|
431
|
+
};
|
|
432
|
+
|
|
419
433
|
/**
|
|
420
434
|
* Get an {@link AsymmetricEqualityTester} that will succeed if the actual
|
|
421
435
|
* value being compared is an instance of the specified class/constructor.
|
|
@@ -872,12 +886,11 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
|
872
886
|
* @property {String} description - The description passed to the {@link it} that created this spec.
|
|
873
887
|
* @property {String} fullName - The full description including all ancestors of this spec.
|
|
874
888
|
* @property {String|null} parentSuiteId - The ID of the suite containing this spec, or null if this spec is not in a describe().
|
|
875
|
-
* @property {String} filename -
|
|
889
|
+
* @property {String} filename - The name of the file the spec was defined in.
|
|
876
890
|
* Note: The value may be incorrect if zone.js is installed or
|
|
877
891
|
* `it`/`fit`/`xit` have been replaced with versions that don't maintain the
|
|
878
|
-
* same call stack height as the originals.
|
|
879
|
-
*
|
|
880
|
-
* See {@link https://github.com/jasmine/jasmine/issues/2065}.
|
|
892
|
+
* same call stack height as the originals. You can fix that by setting
|
|
893
|
+
* {@link Configuration#extraItStackFrames}.
|
|
881
894
|
* @property {ExpectationResult[]} failedExpectations - The list of expectations that failed during execution of this spec.
|
|
882
895
|
* @property {ExpectationResult[]} passedExpectations - The list of expectations that passed during execution of this spec.
|
|
883
896
|
* @property {ExpectationResult[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
|
|
@@ -1051,7 +1064,20 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
|
1051
1064
|
* @returns {Array.<string>}
|
|
1052
1065
|
* @since 5.7.0
|
|
1053
1066
|
*/
|
|
1054
|
-
getPath: this.getPath.bind(this)
|
|
1067
|
+
getPath: this.getPath.bind(this),
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* The name of the file the spec was defined in.
|
|
1071
|
+
* Note: The value may be incorrect if zone.js is installed or
|
|
1072
|
+
* `it`/`fit`/`xit` have been replaced with versions that don't maintain the
|
|
1073
|
+
* same call stack height as the originals. You can fix that by setting
|
|
1074
|
+
* {@link Configuration#extraItStackFrames}.
|
|
1075
|
+
* @name Spec#filename
|
|
1076
|
+
* @readonly
|
|
1077
|
+
* @type {string}
|
|
1078
|
+
* @since 5.13.0
|
|
1079
|
+
*/
|
|
1080
|
+
filename: this.filename
|
|
1055
1081
|
};
|
|
1056
1082
|
}
|
|
1057
1083
|
|
|
@@ -1126,6 +1152,8 @@ getJasmineRequireObj().Order = function() {
|
|
|
1126
1152
|
};
|
|
1127
1153
|
|
|
1128
1154
|
getJasmineRequireObj().Env = function(j$) {
|
|
1155
|
+
const DEFAULT_IT_DESCRIBE_STACK_DEPTH = 3;
|
|
1156
|
+
|
|
1129
1157
|
/**
|
|
1130
1158
|
* @class Env
|
|
1131
1159
|
* @since 2.0.0
|
|
@@ -1720,14 +1748,14 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
1720
1748
|
|
|
1721
1749
|
this.describe = function(description, definitionFn) {
|
|
1722
1750
|
ensureIsNotNested('describe');
|
|
1723
|
-
const filename =
|
|
1751
|
+
const filename = indirectCallerFilename(describeStackDepth());
|
|
1724
1752
|
return suiteBuilder.describe(description, definitionFn, filename)
|
|
1725
1753
|
.metadata;
|
|
1726
1754
|
};
|
|
1727
1755
|
|
|
1728
1756
|
this.xdescribe = function(description, definitionFn) {
|
|
1729
1757
|
ensureIsNotNested('xdescribe');
|
|
1730
|
-
const filename =
|
|
1758
|
+
const filename = indirectCallerFilename(describeStackDepth());
|
|
1731
1759
|
return suiteBuilder.xdescribe(description, definitionFn, filename)
|
|
1732
1760
|
.metadata;
|
|
1733
1761
|
};
|
|
@@ -1735,30 +1763,38 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
1735
1763
|
this.fdescribe = function(description, definitionFn) {
|
|
1736
1764
|
ensureIsNotNested('fdescribe');
|
|
1737
1765
|
ensureNonParallel('fdescribe');
|
|
1738
|
-
const filename =
|
|
1766
|
+
const filename = indirectCallerFilename(describeStackDepth());
|
|
1739
1767
|
return suiteBuilder.fdescribe(description, definitionFn, filename)
|
|
1740
1768
|
.metadata;
|
|
1741
1769
|
};
|
|
1742
1770
|
|
|
1743
1771
|
this.it = function(description, fn, timeout) {
|
|
1744
1772
|
ensureIsNotNested('it');
|
|
1745
|
-
const filename =
|
|
1773
|
+
const filename = indirectCallerFilename(itStackDepth());
|
|
1746
1774
|
return suiteBuilder.it(description, fn, timeout, filename).metadata;
|
|
1747
1775
|
};
|
|
1748
1776
|
|
|
1749
1777
|
this.xit = function(description, fn, timeout) {
|
|
1750
1778
|
ensureIsNotNested('xit');
|
|
1751
|
-
const filename =
|
|
1779
|
+
const filename = indirectCallerFilename(itStackDepth());
|
|
1752
1780
|
return suiteBuilder.xit(description, fn, timeout, filename).metadata;
|
|
1753
1781
|
};
|
|
1754
1782
|
|
|
1755
1783
|
this.fit = function(description, fn, timeout) {
|
|
1756
1784
|
ensureIsNotNested('fit');
|
|
1757
1785
|
ensureNonParallel('fit');
|
|
1758
|
-
const filename =
|
|
1786
|
+
const filename = indirectCallerFilename(itStackDepth());
|
|
1759
1787
|
return suiteBuilder.fit(description, fn, timeout, filename).metadata;
|
|
1760
1788
|
};
|
|
1761
1789
|
|
|
1790
|
+
function itStackDepth() {
|
|
1791
|
+
return DEFAULT_IT_DESCRIBE_STACK_DEPTH + config.extraItStackFrames;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
function describeStackDepth() {
|
|
1795
|
+
return DEFAULT_IT_DESCRIBE_STACK_DEPTH + config.extraDescribeStackFrames;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1762
1798
|
/**
|
|
1763
1799
|
* Get a user-defined property as part of the properties field of {@link SpecResult}
|
|
1764
1800
|
* @name Env#getSpecProperty
|
|
@@ -1944,11 +1980,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
1944
1980
|
};
|
|
1945
1981
|
}
|
|
1946
1982
|
|
|
1947
|
-
function
|
|
1983
|
+
function indirectCallerFilename(depth) {
|
|
1948
1984
|
const frames = new j$.StackTrace(new Error()).frames;
|
|
1949
|
-
//
|
|
1950
|
-
// the global it/describe layer, but
|
|
1951
|
-
|
|
1985
|
+
// The specified frame should always exist except in Jasmine's own tests,
|
|
1986
|
+
// which bypass the global it/describe layer, but could be absent in case
|
|
1987
|
+
// of misconfiguration. Don't crash if it's absent.
|
|
1988
|
+
return frames[depth] && frames[depth].file;
|
|
1952
1989
|
}
|
|
1953
1990
|
|
|
1954
1991
|
return Env;
|
|
@@ -2084,6 +2121,34 @@ getJasmineRequireObj().JsApiReporter = function(j$) {
|
|
|
2084
2121
|
return JsApiReporter;
|
|
2085
2122
|
};
|
|
2086
2123
|
|
|
2124
|
+
getJasmineRequireObj().AllOf = function(j$) {
|
|
2125
|
+
function AllOf() {
|
|
2126
|
+
const expectedValues = Array.from(arguments);
|
|
2127
|
+
if (expectedValues.length === 0) {
|
|
2128
|
+
throw new TypeError(
|
|
2129
|
+
'jasmine.allOf() expects at least one argument to be passed.'
|
|
2130
|
+
);
|
|
2131
|
+
}
|
|
2132
|
+
this.expectedValues = expectedValues;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
AllOf.prototype.asymmetricMatch = function(other, matchersUtil) {
|
|
2136
|
+
for (const expectedValue of this.expectedValues) {
|
|
2137
|
+
if (!matchersUtil.equals(other, expectedValue)) {
|
|
2138
|
+
return false;
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
return true;
|
|
2143
|
+
};
|
|
2144
|
+
|
|
2145
|
+
AllOf.prototype.jasmineToString = function(pp) {
|
|
2146
|
+
return '<jasmine.allOf(' + pp(this.expectedValues) + ')>';
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
return AllOf;
|
|
2150
|
+
};
|
|
2151
|
+
|
|
2087
2152
|
getJasmineRequireObj().Any = function(j$) {
|
|
2088
2153
|
function Any(expectedObject) {
|
|
2089
2154
|
if (typeof expectedObject === 'undefined') {
|
|
@@ -3389,7 +3454,30 @@ getJasmineRequireObj().Configuration = function(j$) {
|
|
|
3389
3454
|
* @type Boolean
|
|
3390
3455
|
* @default false
|
|
3391
3456
|
*/
|
|
3392
|
-
detectLateRejectionHandling: false
|
|
3457
|
+
detectLateRejectionHandling: false,
|
|
3458
|
+
|
|
3459
|
+
/**
|
|
3460
|
+
* The number of extra stack frames inserted by a wrapper around {@link it}
|
|
3461
|
+
* or by some other local modification. Jasmine uses this to determine the
|
|
3462
|
+
* filename for {@link SpecStartedEvent} and {@link SpecDoneEvent}.
|
|
3463
|
+
* @name Configuration#extraItStackFrames
|
|
3464
|
+
* @since 5.13.0
|
|
3465
|
+
* @type number
|
|
3466
|
+
* @default 0
|
|
3467
|
+
*/
|
|
3468
|
+
extraItStackFrames: 0,
|
|
3469
|
+
|
|
3470
|
+
/**
|
|
3471
|
+
* The number of extra stack frames inserted by a wrapper around
|
|
3472
|
+
* {@link describe} or by some other local modification. Jasmine uses this
|
|
3473
|
+
* to determine the filename for {@link SpecStartedEvent} and
|
|
3474
|
+
* {@link SpecDoneEvent}.
|
|
3475
|
+
* @name Configuration#extraDescribeStackFrames
|
|
3476
|
+
* @since 5.13.0
|
|
3477
|
+
* @type number
|
|
3478
|
+
* @default 0
|
|
3479
|
+
*/
|
|
3480
|
+
extraDescribeStackFrames: 0
|
|
3393
3481
|
};
|
|
3394
3482
|
Object.freeze(defaultConfig);
|
|
3395
3483
|
|
|
@@ -3445,6 +3533,16 @@ getJasmineRequireObj().Configuration = function(j$) {
|
|
|
3445
3533
|
if (changes.hasOwnProperty('verboseDeprecations')) {
|
|
3446
3534
|
this.#values.verboseDeprecations = changes.verboseDeprecations;
|
|
3447
3535
|
}
|
|
3536
|
+
|
|
3537
|
+
// 0 is a valid value for both of these, so a truthiness check wouldn't work
|
|
3538
|
+
if (typeof changes.extraItStackFrames !== 'undefined') {
|
|
3539
|
+
this.#values.extraItStackFrames = changes.extraItStackFrames;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
if (typeof changes.extraDescribeStackFrames !== 'undefined') {
|
|
3543
|
+
this.#values.extraDescribeStackFrames =
|
|
3544
|
+
changes.extraDescribeStackFrames;
|
|
3545
|
+
}
|
|
3448
3546
|
}
|
|
3449
3547
|
}
|
|
3450
3548
|
|
|
@@ -10621,12 +10719,11 @@ getJasmineRequireObj().Suite = function(j$) {
|
|
|
10621
10719
|
* @property {String} description - The description text passed to the {@link describe} that made this suite.
|
|
10622
10720
|
* @property {String} fullName - The full description including all ancestors of this suite.
|
|
10623
10721
|
* @property {String|null} parentSuiteId - The ID of the suite containing this suite, or null if this is not in another describe().
|
|
10624
|
-
* @property {String} filename -
|
|
10722
|
+
* @property {String} filename - The name of the file the suite was defined in.
|
|
10625
10723
|
* Note: The value may be incorrect if zone.js is installed or
|
|
10626
10724
|
* `describe`/`fdescribe`/`xdescribe` have been replaced with versions that
|
|
10627
|
-
* don't maintain the same call stack height as the originals.
|
|
10628
|
-
*
|
|
10629
|
-
* in keeping it. See {@link https://github.com/jasmine/jasmine/issues/2065}.
|
|
10725
|
+
* don't maintain the same call stack height as the originals. You can fix
|
|
10726
|
+
* that by setting {@link Configuration#extraDescribeStackFrames}.
|
|
10630
10727
|
* @property {ExpectationResult[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
|
|
10631
10728
|
* @property {ExpectationResult[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
|
|
10632
10729
|
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
|
|
@@ -10833,6 +10930,19 @@ getJasmineRequireObj().Suite = function(j$) {
|
|
|
10833
10930
|
* @since 2.0.0
|
|
10834
10931
|
*/
|
|
10835
10932
|
this.description = suite.description;
|
|
10933
|
+
|
|
10934
|
+
/**
|
|
10935
|
+
* The name of the file the suite was defined in.
|
|
10936
|
+
* Note: The value may be incorrect if zone.js is installed or
|
|
10937
|
+
* `describe`/`fdescribe`/`xdescribe` have been replaced with versions
|
|
10938
|
+
* that don't maintain the same call stack height as the originals. You
|
|
10939
|
+
* can fix that by setting {@link Configuration#extraItStackFrames}.
|
|
10940
|
+
* @name Suite#filename
|
|
10941
|
+
* @readonly
|
|
10942
|
+
* @type {string}
|
|
10943
|
+
* @since 5.13.0
|
|
10944
|
+
*/
|
|
10945
|
+
this.filename = suite.filename;
|
|
10836
10946
|
}
|
|
10837
10947
|
|
|
10838
10948
|
/**
|
|
@@ -11514,7 +11624,10 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
|
|
11514
11624
|
_executeSpec(spec, specOverallDone) {
|
|
11515
11625
|
const onStart = next => {
|
|
11516
11626
|
this.#currentRunableTracker.setCurrentSpec(spec);
|
|
11517
|
-
this.#runableResources.initForRunable(
|
|
11627
|
+
this.#runableResources.initForRunable(
|
|
11628
|
+
spec.id,
|
|
11629
|
+
spec.parentSuiteId || this.#executionTree.topSuite.id
|
|
11630
|
+
);
|
|
11518
11631
|
this.#reportDispatcher.specStarted(spec.result).then(next);
|
|
11519
11632
|
};
|
|
11520
11633
|
const resultCallback = (result, next) => {
|
|
@@ -11788,5 +11901,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
|
|
11788
11901
|
};
|
|
11789
11902
|
|
|
11790
11903
|
getJasmineRequireObj().version = function() {
|
|
11791
|
-
return '5.
|
|
11904
|
+
return '5.13.0';
|
|
11792
11905
|
};
|