jasmine-core 6.0.0-alpha.2 → 6.0.0-beta.1
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/lib/jasmine-core/boot1.js +5 -24
- package/lib/jasmine-core/jasmine-html.js +17 -68
- package/lib/jasmine-core/jasmine.js +130 -40
- package/package.json +4 -4
|
@@ -41,23 +41,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
41
41
|
const env = jasmine.getEnv();
|
|
42
42
|
const urls = new jasmine.HtmlReporterV2Urls();
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* ## Reporters
|
|
46
|
-
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
|
47
|
-
*/
|
|
48
|
-
const htmlReporter = new jasmine.HtmlReporterV2({
|
|
49
|
-
env,
|
|
50
|
-
urls,
|
|
51
|
-
getContainer() {
|
|
52
|
-
return document.body;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
|
|
58
|
-
*/
|
|
59
|
-
env.addReporter(jsApiReporter);
|
|
60
|
-
env.addReporter(htmlReporter);
|
|
61
44
|
/**
|
|
62
45
|
* Configures Jasmine based on the current set of query parameters. This
|
|
63
46
|
* supports all parameters set by the HTML reporter as well as
|
|
@@ -66,18 +49,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
66
49
|
*/
|
|
67
50
|
env.configure(urls.configFromCurrentUrl());
|
|
68
51
|
|
|
69
|
-
/**
|
|
70
|
-
* ## Execution
|
|
71
|
-
*
|
|
72
|
-
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
|
|
73
|
-
*/
|
|
74
52
|
const currentWindowOnload = window.onload;
|
|
75
|
-
|
|
76
53
|
window.onload = function() {
|
|
77
54
|
if (currentWindowOnload) {
|
|
78
55
|
currentWindowOnload();
|
|
79
56
|
}
|
|
80
|
-
|
|
57
|
+
|
|
58
|
+
// The HTML reporter needs to be set up here so it can access the DOM. Other
|
|
59
|
+
// reporters can be added at any time before env.execute() is called.
|
|
60
|
+
const htmlReporter = new jasmine.HtmlReporterV2({ env, urls });
|
|
61
|
+
env.addReporter(htmlReporter);
|
|
81
62
|
env.execute();
|
|
82
63
|
};
|
|
83
64
|
})();
|
|
@@ -309,12 +309,14 @@ jasmineRequire.HtmlSpecFilter = function(j$) {
|
|
|
309
309
|
* @deprecated Use {@link HtmlReporterV2Urls} instead.
|
|
310
310
|
*/
|
|
311
311
|
function HtmlSpecFilter(options) {
|
|
312
|
-
j$.getEnv()
|
|
312
|
+
const env = options?.env ?? j$.getEnv();
|
|
313
|
+
env.deprecated(
|
|
313
314
|
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.'
|
|
314
315
|
);
|
|
315
316
|
|
|
316
317
|
const filterString =
|
|
317
318
|
options &&
|
|
319
|
+
options.filterString &&
|
|
318
320
|
options.filterString() &&
|
|
319
321
|
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
320
322
|
const filterPattern = new RegExp(filterString);
|
|
@@ -472,45 +474,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|
|
472
474
|
);
|
|
473
475
|
}
|
|
474
476
|
|
|
475
|
-
// TODO: remove this once HtmlReporterV2 doesn't use it
|
|
476
|
-
addFailureToggle(onClickFailures, onClickSpecList) {
|
|
477
|
-
const failuresLink = createDom(
|
|
478
|
-
'a',
|
|
479
|
-
{ className: 'jasmine-failures-menu', href: '#' },
|
|
480
|
-
'Failures'
|
|
481
|
-
);
|
|
482
|
-
let specListLink = createDom(
|
|
483
|
-
'a',
|
|
484
|
-
{ className: 'jasmine-spec-list-menu', href: '#' },
|
|
485
|
-
'Spec List'
|
|
486
|
-
);
|
|
487
|
-
|
|
488
|
-
failuresLink.onclick = function() {
|
|
489
|
-
onClickFailures();
|
|
490
|
-
return false;
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
specListLink.onclick = function() {
|
|
494
|
-
onClickSpecList();
|
|
495
|
-
return false;
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
this.rootEl.appendChild(
|
|
499
|
-
createDom(
|
|
500
|
-
'span',
|
|
501
|
-
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
|
502
|
-
[createDom('span', {}, 'Spec List | '), failuresLink]
|
|
503
|
-
)
|
|
504
|
-
);
|
|
505
|
-
this.rootEl.appendChild(
|
|
506
|
-
createDom(
|
|
507
|
-
'span',
|
|
508
|
-
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
|
509
|
-
[specListLink, createDom('span', {}, ' | Failures ')]
|
|
510
|
-
)
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
477
|
addGlobalFailure(failure) {
|
|
515
478
|
this.#createAndAdd(
|
|
516
479
|
errorBarClassName,
|
|
@@ -940,7 +903,7 @@ jasmineRequire.htmlReporterUtils = function(j$) {
|
|
|
940
903
|
const el = document.createElement(type);
|
|
941
904
|
let children;
|
|
942
905
|
|
|
943
|
-
if (
|
|
906
|
+
if (Array.isArray(childrenArrayOrVarArgs)) {
|
|
944
907
|
children = childrenArrayOrVarArgs;
|
|
945
908
|
} else {
|
|
946
909
|
children = [];
|
|
@@ -1007,12 +970,12 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1007
970
|
* const reporter = new jasmine.HtmlReporterV2({
|
|
1008
971
|
* env,
|
|
1009
972
|
* urls,
|
|
1010
|
-
*
|
|
973
|
+
* // container is optional and defaults to document.body.
|
|
974
|
+
* container: someElement
|
|
1011
975
|
* });
|
|
1012
976
|
*/
|
|
1013
977
|
class HtmlReporterV2 {
|
|
1014
|
-
#
|
|
1015
|
-
#getContainer;
|
|
978
|
+
#container;
|
|
1016
979
|
#queryString;
|
|
1017
980
|
#urlBuilder;
|
|
1018
981
|
#filterSpecs;
|
|
@@ -1029,9 +992,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1029
992
|
#failures;
|
|
1030
993
|
|
|
1031
994
|
constructor(options) {
|
|
1032
|
-
this.#
|
|
1033
|
-
|
|
1034
|
-
this.#getContainer = options.getContainer;
|
|
995
|
+
this.#container = options.container || document.body;
|
|
1035
996
|
this.#queryString =
|
|
1036
997
|
options.queryString ||
|
|
1037
998
|
new j$.QueryString({
|
|
@@ -1044,16 +1005,8 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1044
1005
|
getSuiteById: id => this.#stateBuilder.suitesById[id]
|
|
1045
1006
|
});
|
|
1046
1007
|
this.#filterSpecs = options.urls.filteringSpecs();
|
|
1047
|
-
}
|
|
1048
1008
|
|
|
1049
|
-
|
|
1050
|
-
* Initializes the reporter. Should be called before {@link Env#execute}.
|
|
1051
|
-
* @function
|
|
1052
|
-
* @name HtmlReporter#initialize
|
|
1053
|
-
*/
|
|
1054
|
-
initialize() {
|
|
1055
|
-
this.#clearPrior();
|
|
1056
|
-
this.#config = this.#env ? this.#env.configuration() : {};
|
|
1009
|
+
this.#config = options.env ? options.env.configuration() : {};
|
|
1057
1010
|
|
|
1058
1011
|
this.#stateBuilder = new j$.private.ResultsStateBuilder();
|
|
1059
1012
|
|
|
@@ -1094,13 +1047,15 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1094
1047
|
this.#alerts.rootEl,
|
|
1095
1048
|
this.#failures.rootEl
|
|
1096
1049
|
);
|
|
1097
|
-
this.#
|
|
1050
|
+
this.#container.appendChild(this.#htmlReporterMain);
|
|
1098
1051
|
this.#failures.show();
|
|
1099
1052
|
}
|
|
1100
1053
|
|
|
1101
1054
|
jasmineStarted(options) {
|
|
1102
1055
|
this.#stateBuilder.jasmineStarted(options);
|
|
1103
|
-
this.#progress.start(
|
|
1056
|
+
this.#progress.start(
|
|
1057
|
+
options.totalSpecsDefined - options.numExcludedSpecs
|
|
1058
|
+
);
|
|
1104
1059
|
}
|
|
1105
1060
|
|
|
1106
1061
|
suiteStarted(result) {
|
|
@@ -1185,19 +1140,11 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1185
1140
|
}
|
|
1186
1141
|
|
|
1187
1142
|
#find(selector) {
|
|
1188
|
-
return this.#
|
|
1143
|
+
return this.#container.querySelector(
|
|
1189
1144
|
'.jasmine_html-reporter ' + selector
|
|
1190
1145
|
);
|
|
1191
1146
|
}
|
|
1192
1147
|
|
|
1193
|
-
#clearPrior() {
|
|
1194
|
-
const oldReporter = this.#find('');
|
|
1195
|
-
|
|
1196
|
-
if (oldReporter) {
|
|
1197
|
-
this.#getContainer().removeChild(oldReporter);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
1148
|
#setMenuModeTo(mode) {
|
|
1202
1149
|
this.#htmlReporterMain.setAttribute(
|
|
1203
1150
|
'class',
|
|
@@ -1216,7 +1163,9 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1216
1163
|
}
|
|
1217
1164
|
|
|
1218
1165
|
specDone(result) {
|
|
1219
|
-
|
|
1166
|
+
if (result.status !== 'excluded') {
|
|
1167
|
+
this.rootEl.value = this.rootEl.value + 1;
|
|
1168
|
+
}
|
|
1220
1169
|
|
|
1221
1170
|
if (result.status === 'failed') {
|
|
1222
1171
|
this.rootEl.classList.add('failed');
|
|
@@ -44,9 +44,14 @@ var getJasmineRequireObj = (function() {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
getJasmineRequire().core = function(jRequire) {
|
|
47
|
-
const j$ = {
|
|
47
|
+
const j$ = {};
|
|
48
|
+
Object.defineProperty(j$, 'private', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
value: {}
|
|
51
|
+
});
|
|
48
52
|
|
|
49
53
|
jRequire.base(j$, globalThis);
|
|
54
|
+
j$.private.deprecateMonkeyPatching = jRequire.deprecateMonkeyPatching(j$);
|
|
50
55
|
j$.private.util = jRequire.util(j$);
|
|
51
56
|
j$.private.errors = jRequire.errors();
|
|
52
57
|
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
|
|
@@ -56,7 +61,7 @@ var getJasmineRequireObj = (function() {
|
|
|
56
61
|
j$.private.CallTracker = jRequire.CallTracker(j$);
|
|
57
62
|
j$.private.MockDate = jRequire.MockDate(j$);
|
|
58
63
|
j$.private.getStackClearer = jRequire.StackClearer(j$);
|
|
59
|
-
j$.private.Clock = jRequire.Clock();
|
|
64
|
+
j$.private.Clock = jRequire.Clock(j$);
|
|
60
65
|
j$.private.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(j$);
|
|
61
66
|
j$.private.Deprecator = jRequire.Deprecator(j$);
|
|
62
67
|
j$.private.Configuration = jRequire.Configuration(j$);
|
|
@@ -122,6 +127,20 @@ var getJasmineRequireObj = (function() {
|
|
|
122
127
|
j$.private.loadedAsBrowserEsm =
|
|
123
128
|
globalThis.document && !globalThis.document.currentScript;
|
|
124
129
|
|
|
130
|
+
j$.private.deprecateMonkeyPatching(j$, [
|
|
131
|
+
// These are meant to be set by users.
|
|
132
|
+
'DEFAULT_TIMEOUT_INTERVAL',
|
|
133
|
+
'MAX_PRETTY_PRINT_ARRAY_LENGTH',
|
|
134
|
+
'MAX_PRETTY_PRINT_CHARS',
|
|
135
|
+
'MAX_PRETTY_PRINT_DEPTH',
|
|
136
|
+
|
|
137
|
+
// These are part of the deprecation warning mechanism. To avoid infinite
|
|
138
|
+
// recursion, they're separately protected in a way that doesn't emit
|
|
139
|
+
// deprecation warnings.
|
|
140
|
+
'private',
|
|
141
|
+
'getEnv'
|
|
142
|
+
]);
|
|
143
|
+
|
|
125
144
|
return j$;
|
|
126
145
|
};
|
|
127
146
|
|
|
@@ -246,16 +265,15 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|
|
246
265
|
* @function
|
|
247
266
|
* @return {Env}
|
|
248
267
|
*/
|
|
249
|
-
j
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
};
|
|
268
|
+
Object.defineProperty(j$, 'getEnv', {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
value: function(options) {
|
|
271
|
+
const env = (j$.private.currentEnv_ =
|
|
272
|
+
j$.private.currentEnv_ || new j$.private.Env(options));
|
|
273
|
+
//jasmine. singletons in here (setTimeout blah blah).
|
|
274
|
+
return env;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
259
277
|
|
|
260
278
|
j$.private.isObject = function(value) {
|
|
261
279
|
return (
|
|
@@ -956,7 +974,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
|
956
974
|
* @property {ExpectationResult[]} passedExpectations - The list of expectations that passed during execution of this spec.
|
|
957
975
|
* @property {ExpectationResult[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
|
|
958
976
|
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
|
|
959
|
-
* @property {String} status -
|
|
977
|
+
* @property {String} status - The result of this spec. May be 'passed', 'failed', 'pending', or 'excluded'.
|
|
960
978
|
* @property {number} duration - The time in ms used by the spec execution, including any before/afterEach.
|
|
961
979
|
* @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSpecProperty}
|
|
962
980
|
* @property {DebugLogEntry[]|null} debugLogs - Messages, if any, that were logged using {@link jasmine.debugLog} during a failing spec.
|
|
@@ -1520,10 +1538,13 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
1520
1538
|
* @param {String|Error} deprecation The deprecation message
|
|
1521
1539
|
* @param {Object} [options] Optional extra options, as described above
|
|
1522
1540
|
*/
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1541
|
+
Object.defineProperty(this, 'deprecated', {
|
|
1542
|
+
enumerable: true,
|
|
1543
|
+
value: function(deprecation, options) {
|
|
1544
|
+
const runable = runner.currentRunable() || topSuite;
|
|
1545
|
+
deprecator.addDeprecationWarning(runable, deprecation, options);
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1527
1548
|
|
|
1528
1549
|
function runQueue(options) {
|
|
1529
1550
|
options.clearStack = options.clearStack || stackClearer;
|
|
@@ -1550,7 +1571,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
1550
1571
|
runQueue
|
|
1551
1572
|
});
|
|
1552
1573
|
topSuite = suiteBuilder.topSuite;
|
|
1553
|
-
const deprecator =
|
|
1574
|
+
const deprecator =
|
|
1575
|
+
envOptions?.deprecator ?? new j$.private.Deprecator(topSuite);
|
|
1554
1576
|
|
|
1555
1577
|
/**
|
|
1556
1578
|
* Provides the root suite, through which all suites and specs can be
|
|
@@ -2045,9 +2067,18 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
2045
2067
|
}
|
|
2046
2068
|
};
|
|
2047
2069
|
|
|
2070
|
+
this.pp = function(value) {
|
|
2071
|
+
const pp = runner.currentRunable()
|
|
2072
|
+
? runableResources.makePrettyPrinter()
|
|
2073
|
+
: j$.private.basicPrettyPrinter;
|
|
2074
|
+
return pp(value);
|
|
2075
|
+
};
|
|
2076
|
+
|
|
2048
2077
|
this.cleanup_ = function() {
|
|
2049
2078
|
uninstallGlobalErrors();
|
|
2050
2079
|
};
|
|
2080
|
+
|
|
2081
|
+
j$.private.deprecateMonkeyPatching(this, ['deprecated']);
|
|
2051
2082
|
}
|
|
2052
2083
|
|
|
2053
2084
|
function indirectCallerFilename(depth) {
|
|
@@ -2064,11 +2095,13 @@ getJasmineRequireObj().Env = function(j$) {
|
|
|
2064
2095
|
getJasmineRequireObj().JsApiReporter = function(j$) {
|
|
2065
2096
|
'use strict';
|
|
2066
2097
|
|
|
2098
|
+
// TODO: remove in 7.0.
|
|
2067
2099
|
/**
|
|
2068
2100
|
* @name jsApiReporter
|
|
2069
2101
|
* @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.
|
|
2070
2102
|
* @class
|
|
2071
2103
|
* @hideconstructor
|
|
2104
|
+
* @deprecated In most cases jsApiReporter can simply be removed. If necessary, it can be replaced with a {@link Reporter|custom reporter}.
|
|
2072
2105
|
*/
|
|
2073
2106
|
function JsApiReporter(options) {
|
|
2074
2107
|
const timer = options.timer || new j$.Timer();
|
|
@@ -2295,7 +2328,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
|
|
2295
2328
|
}
|
|
2296
2329
|
|
|
2297
2330
|
ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
|
2298
|
-
if (!
|
|
2331
|
+
if (!Array.isArray(this.sample)) {
|
|
2299
2332
|
throw new Error(
|
|
2300
2333
|
'You must provide an array to arrayContaining, not ' +
|
|
2301
2334
|
j$.private.basicPrettyPrinter(this.sample) +
|
|
@@ -2306,7 +2339,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
|
|
2306
2339
|
// If the actual parameter is not an array, we can fail immediately, since it couldn't
|
|
2307
2340
|
// possibly be an "array containing" anything. However, we also want an empty sample
|
|
2308
2341
|
// array to match anything, so we need to double-check we aren't in that case
|
|
2309
|
-
if (!
|
|
2342
|
+
if (!Array.isArray(other) && this.sample.length > 0) {
|
|
2310
2343
|
return false;
|
|
2311
2344
|
}
|
|
2312
2345
|
|
|
@@ -2337,7 +2370,7 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
|
|
|
2337
2370
|
other,
|
|
2338
2371
|
matchersUtil
|
|
2339
2372
|
) {
|
|
2340
|
-
if (!
|
|
2373
|
+
if (!Array.isArray(this.sample)) {
|
|
2341
2374
|
throw new Error(
|
|
2342
2375
|
'You must provide an array to arrayWithExactContents, not ' +
|
|
2343
2376
|
j$.private.basicPrettyPrinter(this.sample) +
|
|
@@ -2373,7 +2406,7 @@ getJasmineRequireObj().Empty = function(j$) {
|
|
|
2373
2406
|
Empty.prototype.asymmetricMatch = function(other) {
|
|
2374
2407
|
if (
|
|
2375
2408
|
j$.private.isString(other) ||
|
|
2376
|
-
|
|
2409
|
+
Array.isArray(other) ||
|
|
2377
2410
|
j$.private.isTypedArray(other)
|
|
2378
2411
|
) {
|
|
2379
2412
|
return other.length === 0;
|
|
@@ -2488,7 +2521,7 @@ getJasmineRequireObj().NotEmpty = function(j$) {
|
|
|
2488
2521
|
NotEmpty.prototype.asymmetricMatch = function(other) {
|
|
2489
2522
|
if (
|
|
2490
2523
|
j$.private.isString(other) ||
|
|
2491
|
-
|
|
2524
|
+
Array.isArray(other) ||
|
|
2492
2525
|
j$.private.isTypedArray(other)
|
|
2493
2526
|
) {
|
|
2494
2527
|
return other.length !== 0;
|
|
@@ -2920,7 +2953,7 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
|
|
2920
2953
|
return CallTracker;
|
|
2921
2954
|
};
|
|
2922
2955
|
|
|
2923
|
-
getJasmineRequireObj().Clock = function() {
|
|
2956
|
+
getJasmineRequireObj().Clock = function(j$) {
|
|
2924
2957
|
'use strict';
|
|
2925
2958
|
|
|
2926
2959
|
/* global process */
|
|
@@ -3113,6 +3146,9 @@ callbacks to execute _before_ running the next one.
|
|
|
3113
3146
|
clearTimeout[IsMockClockTimingFn] = true;
|
|
3114
3147
|
setInterval[IsMockClockTimingFn] = true;
|
|
3115
3148
|
clearInterval[IsMockClockTimingFn] = true;
|
|
3149
|
+
|
|
3150
|
+
j$.private.deprecateMonkeyPatching(this);
|
|
3151
|
+
|
|
3116
3152
|
return this;
|
|
3117
3153
|
|
|
3118
3154
|
// Advances the Clock's time until the mode changes.
|
|
@@ -3821,6 +3857,29 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
|
|
3821
3857
|
return DelayedFunctionScheduler;
|
|
3822
3858
|
};
|
|
3823
3859
|
|
|
3860
|
+
getJasmineRequireObj().deprecateMonkeyPatching = function(j$) {
|
|
3861
|
+
return function deprecateMonkeyPatching(obj, keysToSkip) {
|
|
3862
|
+
for (const key of Object.keys(obj)) {
|
|
3863
|
+
if (!keysToSkip?.includes(key)) {
|
|
3864
|
+
let value = obj[key];
|
|
3865
|
+
|
|
3866
|
+
Object.defineProperty(obj, key, {
|
|
3867
|
+
enumerable: key in obj,
|
|
3868
|
+
get() {
|
|
3869
|
+
return value;
|
|
3870
|
+
},
|
|
3871
|
+
set(newValue) {
|
|
3872
|
+
j$.getEnv().deprecated(
|
|
3873
|
+
'Monkey patching detected. This is not supported and will break in a future jasmine-core release.'
|
|
3874
|
+
);
|
|
3875
|
+
value = newValue;
|
|
3876
|
+
}
|
|
3877
|
+
});
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
};
|
|
3881
|
+
};
|
|
3882
|
+
|
|
3824
3883
|
getJasmineRequireObj().Deprecator = function(j$) {
|
|
3825
3884
|
'use strict';
|
|
3826
3885
|
|
|
@@ -5288,7 +5347,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|
|
5288
5347
|
this.customTesters_ = options.customTesters || [];
|
|
5289
5348
|
/**
|
|
5290
5349
|
* Formats a value for use in matcher failure messages and similar contexts,
|
|
5291
|
-
* taking into account the current set of custom
|
|
5350
|
+
* taking into account the current set of custom object formatters.
|
|
5292
5351
|
* @function
|
|
5293
5352
|
* @name MatchersUtil#pp
|
|
5294
5353
|
* @since 3.6.0
|
|
@@ -8200,7 +8259,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
|
|
8200
8259
|
} else if (
|
|
8201
8260
|
value.toString &&
|
|
8202
8261
|
typeof value === 'object' &&
|
|
8203
|
-
!
|
|
8262
|
+
!Array.isArray(value) &&
|
|
8204
8263
|
hasCustomToString(value)
|
|
8205
8264
|
) {
|
|
8206
8265
|
try {
|
|
@@ -8212,15 +8271,12 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
|
|
8212
8271
|
} else if (this.seen.includes(value)) {
|
|
8213
8272
|
this.emitScalar(
|
|
8214
8273
|
'<circular reference: ' +
|
|
8215
|
-
(
|
|
8274
|
+
(Array.isArray(value) ? 'Array' : 'Object') +
|
|
8216
8275
|
'>'
|
|
8217
8276
|
);
|
|
8218
|
-
} else if (
|
|
8219
|
-
j$.private.isArray(value) ||
|
|
8220
|
-
j$.private.isA('Object', value)
|
|
8221
|
-
) {
|
|
8277
|
+
} else if (Array.isArray(value) || j$.private.isA('Object', value)) {
|
|
8222
8278
|
this.seen.push(value);
|
|
8223
|
-
if (
|
|
8279
|
+
if (Array.isArray(value)) {
|
|
8224
8280
|
this.emitArray(value);
|
|
8225
8281
|
} else {
|
|
8226
8282
|
this.emitObject(value);
|
|
@@ -8243,10 +8299,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
|
|
8243
8299
|
}
|
|
8244
8300
|
|
|
8245
8301
|
iterateObject(obj, fn) {
|
|
8246
|
-
const objKeys = j$.private.MatchersUtil.keys(
|
|
8247
|
-
obj,
|
|
8248
|
-
j$.private.isArray(obj)
|
|
8249
|
-
);
|
|
8302
|
+
const objKeys = j$.private.MatchersUtil.keys(obj, Array.isArray(obj));
|
|
8250
8303
|
const length = Math.min(objKeys.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
|
|
8251
8304
|
|
|
8252
8305
|
for (let i = 0; i < length; i++) {
|
|
@@ -9371,6 +9424,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
9371
9424
|
*/
|
|
9372
9425
|
jasmine: jasmine
|
|
9373
9426
|
};
|
|
9427
|
+
const existingKeys = Object.keys(jasmine);
|
|
9374
9428
|
|
|
9375
9429
|
/**
|
|
9376
9430
|
* Add a custom equality tester for the current scope of specs.
|
|
@@ -9500,6 +9554,21 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
9500
9554
|
return env.setDefaultSpyStrategy(defaultStrategyFn);
|
|
9501
9555
|
};
|
|
9502
9556
|
|
|
9557
|
+
/**
|
|
9558
|
+
* Formats a value for display, taking into account the current set of
|
|
9559
|
+
* custom object formatters.
|
|
9560
|
+
*
|
|
9561
|
+
* @name jasmine.pp
|
|
9562
|
+
* @function
|
|
9563
|
+
* @since 6.0.0
|
|
9564
|
+
* @param {*} value The value to pretty-print
|
|
9565
|
+
* @return {string} The pretty-printed value
|
|
9566
|
+
* @see {MatchersUtil#pp}
|
|
9567
|
+
*/
|
|
9568
|
+
jasmine.pp = function(value) {
|
|
9569
|
+
return env.pp(value);
|
|
9570
|
+
};
|
|
9571
|
+
|
|
9503
9572
|
/**
|
|
9504
9573
|
* {@link AsymmetricEqualityTester|Asymmetric equality testers} allow for
|
|
9505
9574
|
* non-exact matching in matchers that use Jasmine's deep value equality
|
|
@@ -9522,6 +9591,8 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
|
9522
9591
|
* @namespace asymmetricEqualityTesters
|
|
9523
9592
|
*/
|
|
9524
9593
|
|
|
9594
|
+
jasmine.private.deprecateMonkeyPatching(jasmine, existingKeys);
|
|
9595
|
+
|
|
9525
9596
|
return jasmineInterface;
|
|
9526
9597
|
};
|
|
9527
9598
|
|
|
@@ -9783,7 +9854,8 @@ getJasmineRequireObj().Runner = function(j$) {
|
|
|
9783
9854
|
/**
|
|
9784
9855
|
* Information passed to the {@link Reporter#jasmineStarted} event.
|
|
9785
9856
|
* @typedef JasmineStartedInfo
|
|
9786
|
-
* @property {
|
|
9857
|
+
* @property {int} totalSpecsDefined - The total number of specs defined in this suite. Note that this property is not present when Jasmine is run in parallel mode.
|
|
9858
|
+
* @property {int} numExcludedSpecs - The number of specs that will be excluded from execution. Note that this property is not present when Jasmine is run in parallel mode.
|
|
9787
9859
|
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite. Note that this property is not present when Jasmine is run in parallel mode.
|
|
9788
9860
|
* @property {Boolean} parallel - Whether Jasmine is being run in parallel mode.
|
|
9789
9861
|
* @since 2.0.0
|
|
@@ -9792,6 +9864,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|
|
9792
9864
|
// In parallel mode, the jasmineStarted event is separately dispatched
|
|
9793
9865
|
// by jasmine-npm. This event only reaches reporters in non-parallel.
|
|
9794
9866
|
totalSpecsDefined,
|
|
9867
|
+
numExcludedSpecs: this.#executionTree.numExcludedSpecs(),
|
|
9795
9868
|
order: orderForReporting(order),
|
|
9796
9869
|
parallel: false
|
|
9797
9870
|
});
|
|
@@ -10154,7 +10227,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
|
|
10154
10227
|
|
|
10155
10228
|
this.createSpyObj = function(baseName, methodNames, propertyNames) {
|
|
10156
10229
|
const baseNameIsCollection =
|
|
10157
|
-
j$.private.isObject(baseName) ||
|
|
10230
|
+
j$.private.isObject(baseName) || Array.isArray(baseName);
|
|
10158
10231
|
|
|
10159
10232
|
if (baseNameIsCollection) {
|
|
10160
10233
|
propertyNames = methodNames;
|
|
@@ -10200,7 +10273,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
|
|
10200
10273
|
|
|
10201
10274
|
function normalizeKeyValues(object) {
|
|
10202
10275
|
const result = [];
|
|
10203
|
-
if (
|
|
10276
|
+
if (Array.isArray(object)) {
|
|
10204
10277
|
for (let i = 0; i < object.length; i++) {
|
|
10205
10278
|
result.push([object[i]]);
|
|
10206
10279
|
}
|
|
@@ -11898,6 +11971,23 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
|
|
|
11898
11971
|
const nodeStats = this.#stats[node.id];
|
|
11899
11972
|
return node.children ? !nodeStats.willExecute : nodeStats.excluded;
|
|
11900
11973
|
}
|
|
11974
|
+
|
|
11975
|
+
numExcludedSpecs(node) {
|
|
11976
|
+
if (!node) {
|
|
11977
|
+
return this.numExcludedSpecs(this.topSuite);
|
|
11978
|
+
} else if (node.children) {
|
|
11979
|
+
let result = 0;
|
|
11980
|
+
|
|
11981
|
+
for (const child of node.children) {
|
|
11982
|
+
result += this.numExcludedSpecs(child);
|
|
11983
|
+
}
|
|
11984
|
+
|
|
11985
|
+
return result;
|
|
11986
|
+
} else {
|
|
11987
|
+
const nodeStats = this.#stats[node.id];
|
|
11988
|
+
return nodeStats.willExecute ? 0 : 1;
|
|
11989
|
+
}
|
|
11990
|
+
}
|
|
11901
11991
|
}
|
|
11902
11992
|
|
|
11903
11993
|
function segmentChildren(node, orderedChildren, stats, executableIndex) {
|
|
@@ -12295,5 +12385,5 @@ getJasmineRequireObj().UserContext = function(j$) {
|
|
|
12295
12385
|
};
|
|
12296
12386
|
|
|
12297
12387
|
getJasmineRequireObj().version = function() {
|
|
12298
|
-
return '6.0.0-
|
|
12388
|
+
return '6.0.0-beta.1';
|
|
12299
12389
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jasmine-core",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "6.0.0-
|
|
4
|
+
"version": "6.0.0-beta.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/jasmine/jasmine.git"
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"ejs": "^3.1.10",
|
|
44
44
|
"eslint": "^9.24.0",
|
|
45
45
|
"eslint-plugin-compat": "^6.0.2",
|
|
46
|
-
"glob": "^
|
|
46
|
+
"glob": "^13.0.0",
|
|
47
47
|
"globals": "^16.0.0",
|
|
48
|
-
"jasmine": "github:jasmine/jasmine-npm
|
|
49
|
-
"jasmine-browser-runner": "github:jasmine/jasmine-browser-runner
|
|
48
|
+
"jasmine": "github:jasmine/jasmine-npm",
|
|
49
|
+
"jasmine-browser-runner": "github:jasmine/jasmine-browser-runner",
|
|
50
50
|
"jsdom": "^26.0.0",
|
|
51
51
|
"prettier": "1.17.1",
|
|
52
52
|
"sass": "^1.58.3"
|