@procore/hammer-test-jest 0.3.0 → 0.4.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 +4 -1
- package/dist/index.d.mts +8 -17
- package/dist/index.d.ts +8 -17
- package/dist/index.js +7 -30
- package/dist/index.mjs +7 -29
- package/dist/transforms/file.test.js +152 -67
- package/dist/transforms/file.test.mjs +152 -67
- package/dist/transforms/reactSvg.test.js +152 -67
- package/dist/transforms/reactSvg.test.mjs +152 -67
- package/package.json +14 -15
package/README.md
CHANGED
|
@@ -38,10 +38,13 @@ This project uses [`yarn`][yarn], and supports the following commands:
|
|
|
38
38
|
- `clean`: deletes the output directory and any built files.
|
|
39
39
|
- `format`: runs [`prettier`][prettier] on the project.
|
|
40
40
|
- `format:check`: uses [`prettier`][prettier] to validate code format.
|
|
41
|
+
- `lint:code`: uses [`eslint`][eslint] to lint code.
|
|
42
|
+
- `lint:types`: uses [`TypeScript`][typescript] to validate types.
|
|
41
43
|
- `test`: runs the unit test suite.
|
|
42
44
|
- `test:ci`: run the unit test suite, reporting coverage.
|
|
43
45
|
|
|
46
|
+
[eslint]: https://eslint.org/
|
|
44
47
|
[jest]: https://jestjs.io/
|
|
45
48
|
[prettier]: https://prettier.io/
|
|
46
|
-
[
|
|
49
|
+
[typescript]: https://www.typescriptlang.org/
|
|
47
50
|
[yarn]: https://classic.yarnpkg.com/
|
package/dist/index.d.mts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _procore_hammer_types from '@procore/hammer-types';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
silent?: boolean;
|
|
10
|
-
config: {
|
|
11
|
-
testJest?: OverrideFn;
|
|
12
|
-
};
|
|
13
|
-
rootDir: string;
|
|
14
|
-
};
|
|
3
|
+
declare const test: (rootDir: string, config: _procore_hammer_types.HammerConfig, options: {
|
|
4
|
+
watch: boolean;
|
|
5
|
+
coverage: boolean;
|
|
6
|
+
ci: boolean;
|
|
7
|
+
silent: boolean;
|
|
8
|
+
}) => Promise<void>;
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
declare function inspect(options: PluginOptions): Promise<void>;
|
|
18
|
-
|
|
19
|
-
export { inspect, test };
|
|
10
|
+
export { test };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _procore_hammer_types from '@procore/hammer-types';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
silent?: boolean;
|
|
10
|
-
config: {
|
|
11
|
-
testJest?: OverrideFn;
|
|
12
|
-
};
|
|
13
|
-
rootDir: string;
|
|
14
|
-
};
|
|
3
|
+
declare const test: (rootDir: string, config: _procore_hammer_types.HammerConfig, options: {
|
|
4
|
+
watch: boolean;
|
|
5
|
+
coverage: boolean;
|
|
6
|
+
ci: boolean;
|
|
7
|
+
silent: boolean;
|
|
8
|
+
}) => Promise<void>;
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
declare function inspect(options: PluginOptions): Promise<void>;
|
|
18
|
-
|
|
19
|
-
export { inspect, test };
|
|
10
|
+
export { test };
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
-
inspect: () => inspect,
|
|
34
33
|
test: () => test
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -39,8 +38,8 @@ module.exports = __toCommonJS(src_exports);
|
|
|
39
38
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
40
39
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
41
40
|
|
|
42
|
-
// src/
|
|
43
|
-
var
|
|
41
|
+
// src/performTest.ts
|
|
42
|
+
var jest = __toESM(require("jest-cli"));
|
|
44
43
|
|
|
45
44
|
// src/config/utils.ts
|
|
46
45
|
var import_fs2 = __toESM(require("fs"));
|
|
@@ -194,26 +193,9 @@ function getConfig(options) {
|
|
|
194
193
|
return options.config.testJest ? options.config.testJest(config) : config;
|
|
195
194
|
}
|
|
196
195
|
|
|
197
|
-
// src/utils/terminal.ts
|
|
198
|
-
var import_cli_highlight = require("cli-highlight");
|
|
199
|
-
function toHighlightedString(input) {
|
|
200
|
-
const inputAsString = JSON.stringify(
|
|
201
|
-
input,
|
|
202
|
-
function(_key, value) {
|
|
203
|
-
return typeof value === "function" ? value.toString() : value;
|
|
204
|
-
},
|
|
205
|
-
2
|
|
206
|
-
);
|
|
207
|
-
return (0, import_cli_highlight.highlight)(inputAsString, { language: "js" });
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/performTest.ts
|
|
211
|
-
var jest = __toESM(require("jest-cli"));
|
|
212
|
-
|
|
213
196
|
// src/utils/argvForJest.ts
|
|
214
197
|
var allowedFlags = [
|
|
215
198
|
"watch",
|
|
216
|
-
"W",
|
|
217
199
|
"coverage",
|
|
218
200
|
"ci",
|
|
219
201
|
"silent"
|
|
@@ -235,17 +217,12 @@ async function performTest(options) {
|
|
|
235
217
|
}
|
|
236
218
|
|
|
237
219
|
// src/index.ts
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
import_node_process.default.stdout.write(`
|
|
244
|
-
${highlightedConfig}
|
|
245
|
-
`);
|
|
246
|
-
}
|
|
220
|
+
var { test } = {
|
|
221
|
+
test: async function test2(rootDir, config, options) {
|
|
222
|
+
await performTest({ ...options, rootDir, config });
|
|
223
|
+
}
|
|
224
|
+
};
|
|
247
225
|
// Annotate the CommonJS export names for ESM import in node:
|
|
248
226
|
0 && (module.exports = {
|
|
249
|
-
inspect,
|
|
250
227
|
test
|
|
251
228
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import
|
|
1
|
+
// src/performTest.ts
|
|
2
|
+
import * as jest from "jest-cli";
|
|
3
3
|
|
|
4
4
|
// src/config/utils.ts
|
|
5
5
|
import fs2 from "fs";
|
|
@@ -153,26 +153,9 @@ function getConfig(options) {
|
|
|
153
153
|
return options.config.testJest ? options.config.testJest(config) : config;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
// src/utils/terminal.ts
|
|
157
|
-
import { highlight } from "cli-highlight";
|
|
158
|
-
function toHighlightedString(input) {
|
|
159
|
-
const inputAsString = JSON.stringify(
|
|
160
|
-
input,
|
|
161
|
-
function(_key, value) {
|
|
162
|
-
return typeof value === "function" ? value.toString() : value;
|
|
163
|
-
},
|
|
164
|
-
2
|
|
165
|
-
);
|
|
166
|
-
return highlight(inputAsString, { language: "js" });
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/performTest.ts
|
|
170
|
-
import * as jest from "jest-cli";
|
|
171
|
-
|
|
172
156
|
// src/utils/argvForJest.ts
|
|
173
157
|
var allowedFlags = [
|
|
174
158
|
"watch",
|
|
175
|
-
"W",
|
|
176
159
|
"coverage",
|
|
177
160
|
"ci",
|
|
178
161
|
"silent"
|
|
@@ -194,16 +177,11 @@ async function performTest(options) {
|
|
|
194
177
|
}
|
|
195
178
|
|
|
196
179
|
// src/index.ts
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
process.stdout.write(`
|
|
203
|
-
${highlightedConfig}
|
|
204
|
-
`);
|
|
205
|
-
}
|
|
180
|
+
var { test } = {
|
|
181
|
+
test: async function test2(rootDir, config, options) {
|
|
182
|
+
await performTest({ ...options, rootDir, config });
|
|
183
|
+
}
|
|
184
|
+
};
|
|
206
185
|
export {
|
|
207
|
-
inspect,
|
|
208
186
|
test
|
|
209
187
|
};
|
|
@@ -7777,7 +7777,14 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
|
7777
7777
|
if (!descriptor)
|
|
7778
7778
|
continue;
|
|
7779
7779
|
const cloned = clone(val[k22], seen, options);
|
|
7780
|
-
if (
|
|
7780
|
+
if (options.forceWritable) {
|
|
7781
|
+
Object.defineProperty(out, k22, {
|
|
7782
|
+
enumerable: descriptor.enumerable,
|
|
7783
|
+
configurable: true,
|
|
7784
|
+
writable: true,
|
|
7785
|
+
value: cloned
|
|
7786
|
+
});
|
|
7787
|
+
} else if ("get" in descriptor) {
|
|
7781
7788
|
Object.defineProperty(out, k22, {
|
|
7782
7789
|
...descriptor,
|
|
7783
7790
|
get() {
|
|
@@ -7787,7 +7794,6 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
|
7787
7794
|
} else {
|
|
7788
7795
|
Object.defineProperty(out, k22, {
|
|
7789
7796
|
...descriptor,
|
|
7790
|
-
writable: options.forceWritable ? true : descriptor.writable,
|
|
7791
7797
|
value: cloned
|
|
7792
7798
|
});
|
|
7793
7799
|
}
|
|
@@ -7949,7 +7955,7 @@ function objDisplay(obj, options = {}) {
|
|
|
7949
7955
|
if (options.truncate && str.length >= options.truncate) {
|
|
7950
7956
|
if (type2 === "[object Function]") {
|
|
7951
7957
|
const fn2 = obj;
|
|
7952
|
-
return !fn2.name
|
|
7958
|
+
return !fn2.name ? "[Function]" : `[Function: ${fn2.name}]`;
|
|
7953
7959
|
} else if (type2 === "[object Array]") {
|
|
7954
7960
|
return `[ Array(${obj.length}) ]`;
|
|
7955
7961
|
} else if (type2 === "[object Object]") {
|
|
@@ -8389,6 +8395,7 @@ function joinAlignedDiffsExpand(diffs, options) {
|
|
|
8389
8395
|
}
|
|
8390
8396
|
var noColor = (string3) => string3;
|
|
8391
8397
|
var DIFF_CONTEXT_DEFAULT = 5;
|
|
8398
|
+
var DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
|
|
8392
8399
|
function getDefaultOptions() {
|
|
8393
8400
|
const c2 = getColors();
|
|
8394
8401
|
return {
|
|
@@ -8409,7 +8416,10 @@ function getDefaultOptions() {
|
|
|
8409
8416
|
expand: true,
|
|
8410
8417
|
includeChangeCounts: false,
|
|
8411
8418
|
omitAnnotationLines: false,
|
|
8412
|
-
patchColor: c2.yellow
|
|
8419
|
+
patchColor: c2.yellow,
|
|
8420
|
+
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
|
|
8421
|
+
truncateAnnotation: "... Diff result is truncated",
|
|
8422
|
+
truncateAnnotationColor: noColor
|
|
8413
8423
|
};
|
|
8414
8424
|
}
|
|
8415
8425
|
function getCompareKeys(compareKeys) {
|
|
@@ -8477,16 +8487,21 @@ ${bColor(b2)}
|
|
|
8477
8487
|
|
|
8478
8488
|
`;
|
|
8479
8489
|
}
|
|
8480
|
-
function printDiffLines(diffs, options) {
|
|
8481
|
-
return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options))
|
|
8490
|
+
function printDiffLines(diffs, truncated, options) {
|
|
8491
|
+
return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options)) + (truncated ? options.truncateAnnotationColor(`
|
|
8492
|
+
${options.truncateAnnotation}`) : "");
|
|
8482
8493
|
}
|
|
8483
8494
|
function diffLinesUnified(aLines, bLines, options) {
|
|
8495
|
+
const normalizedOptions = normalizeDiffOptions(options);
|
|
8496
|
+
const [diffs, truncated] = diffLinesRaw(
|
|
8497
|
+
isEmptyString(aLines) ? [] : aLines,
|
|
8498
|
+
isEmptyString(bLines) ? [] : bLines,
|
|
8499
|
+
normalizedOptions
|
|
8500
|
+
);
|
|
8484
8501
|
return printDiffLines(
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
),
|
|
8489
|
-
normalizeDiffOptions(options)
|
|
8502
|
+
diffs,
|
|
8503
|
+
truncated,
|
|
8504
|
+
normalizedOptions
|
|
8490
8505
|
);
|
|
8491
8506
|
}
|
|
8492
8507
|
function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options) {
|
|
@@ -8501,7 +8516,7 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
|
|
|
8501
8516
|
if (aLinesDisplay.length !== aLinesCompare.length || bLinesDisplay.length !== bLinesCompare.length) {
|
|
8502
8517
|
return diffLinesUnified(aLinesDisplay, bLinesDisplay, options);
|
|
8503
8518
|
}
|
|
8504
|
-
const diffs = diffLinesRaw(aLinesCompare, bLinesCompare);
|
|
8519
|
+
const [diffs, truncated] = diffLinesRaw(aLinesCompare, bLinesCompare, options);
|
|
8505
8520
|
let aIndex = 0;
|
|
8506
8521
|
let bIndex = 0;
|
|
8507
8522
|
diffs.forEach((diff2) => {
|
|
@@ -8520,11 +8535,14 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
|
|
|
8520
8535
|
bIndex += 1;
|
|
8521
8536
|
}
|
|
8522
8537
|
});
|
|
8523
|
-
return printDiffLines(diffs, normalizeDiffOptions(options));
|
|
8524
|
-
}
|
|
8525
|
-
function diffLinesRaw(aLines, bLines) {
|
|
8526
|
-
const
|
|
8527
|
-
const
|
|
8538
|
+
return printDiffLines(diffs, truncated, normalizeDiffOptions(options));
|
|
8539
|
+
}
|
|
8540
|
+
function diffLinesRaw(aLines, bLines, options) {
|
|
8541
|
+
const truncate2 = (options == null ? void 0 : options.truncateThreshold) ?? false;
|
|
8542
|
+
const truncateThreshold = Math.max(Math.floor((options == null ? void 0 : options.truncateThreshold) ?? 0), 0);
|
|
8543
|
+
const aLength = truncate2 ? Math.min(aLines.length, truncateThreshold) : aLines.length;
|
|
8544
|
+
const bLength = truncate2 ? Math.min(bLines.length, truncateThreshold) : bLines.length;
|
|
8545
|
+
const truncated = aLength !== aLines.length || bLength !== bLines.length;
|
|
8528
8546
|
const isCommon = (aIndex2, bIndex2) => aLines[aIndex2] === bLines[bIndex2];
|
|
8529
8547
|
const diffs = [];
|
|
8530
8548
|
let aIndex = 0;
|
|
@@ -8543,7 +8561,7 @@ function diffLinesRaw(aLines, bLines) {
|
|
|
8543
8561
|
diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
|
|
8544
8562
|
for (; bIndex !== bLength; bIndex += 1)
|
|
8545
8563
|
diffs.push(new Diff(DIFF_INSERT, bLines[bIndex]));
|
|
8546
|
-
return diffs;
|
|
8564
|
+
return [diffs, truncated];
|
|
8547
8565
|
}
|
|
8548
8566
|
function getCommonMessage(message, options) {
|
|
8549
8567
|
const { commonColor } = normalizeDiffOptions(options);
|
|
@@ -9733,10 +9751,10 @@ function createSuiteCollector(name, factory = () => {
|
|
|
9733
9751
|
}
|
|
9734
9752
|
if (runner.config.includeTaskLocation) {
|
|
9735
9753
|
const limit = Error.stackTraceLimit;
|
|
9736
|
-
Error.stackTraceLimit =
|
|
9754
|
+
Error.stackTraceLimit = 15;
|
|
9737
9755
|
const error = new Error("stacktrace").stack;
|
|
9738
9756
|
Error.stackTraceLimit = limit;
|
|
9739
|
-
const stack =
|
|
9757
|
+
const stack = findTestFileStackTrace(error, task2.each ?? false);
|
|
9740
9758
|
if (stack)
|
|
9741
9759
|
task2.location = stack;
|
|
9742
9760
|
}
|
|
@@ -9789,18 +9807,12 @@ function createSuiteCollector(name, factory = () => {
|
|
|
9789
9807
|
};
|
|
9790
9808
|
if (runner && includeLocation && runner.config.includeTaskLocation) {
|
|
9791
9809
|
const limit = Error.stackTraceLimit;
|
|
9792
|
-
Error.stackTraceLimit =
|
|
9810
|
+
Error.stackTraceLimit = 15;
|
|
9793
9811
|
const error = new Error("stacktrace").stack;
|
|
9794
9812
|
Error.stackTraceLimit = limit;
|
|
9795
|
-
const stack =
|
|
9796
|
-
if (stack)
|
|
9797
|
-
suite2.location =
|
|
9798
|
-
line: stack.line,
|
|
9799
|
-
// because source map is boundary based, this line leads to ")" in test.each()[(]),
|
|
9800
|
-
// but it should be the next opening bracket - here we assume it's on the same line
|
|
9801
|
-
column: each ? stack.column + 1 : stack.column
|
|
9802
|
-
};
|
|
9803
|
-
}
|
|
9813
|
+
const stack = findTestFileStackTrace(error, suite2.each ?? false);
|
|
9814
|
+
if (stack)
|
|
9815
|
+
suite2.location = stack;
|
|
9804
9816
|
}
|
|
9805
9817
|
setHooks(suite2, createSuiteHooks());
|
|
9806
9818
|
}
|
|
@@ -9944,8 +9956,8 @@ function formatTemplateString(cases, args) {
|
|
|
9944
9956
|
}
|
|
9945
9957
|
return res;
|
|
9946
9958
|
}
|
|
9947
|
-
function
|
|
9948
|
-
const lines = error.split("\n").slice(
|
|
9959
|
+
function findTestFileStackTrace(error, each) {
|
|
9960
|
+
const lines = error.split("\n").slice(1);
|
|
9949
9961
|
for (const line of lines) {
|
|
9950
9962
|
const stack = parseSingleStack(line);
|
|
9951
9963
|
if (stack && stack.file === getTestFilepath()) {
|
|
@@ -10084,7 +10096,7 @@ function isFirstRun() {
|
|
|
10084
10096
|
return firstRun;
|
|
10085
10097
|
}
|
|
10086
10098
|
|
|
10087
|
-
// ../../node_modules/vitest/dist/vendor/vi.
|
|
10099
|
+
// ../../node_modules/vitest/dist/vendor/vi.Y_w82WR8.js
|
|
10088
10100
|
init_cjs_shims();
|
|
10089
10101
|
|
|
10090
10102
|
// ../../node_modules/chai/index.mjs
|
|
@@ -10612,7 +10624,7 @@ function iterableEquality(a, b2, customTesters = [], aStack = [], bStack = []) {
|
|
|
10612
10624
|
return iterableEquality(
|
|
10613
10625
|
a2,
|
|
10614
10626
|
b22,
|
|
10615
|
-
[...
|
|
10627
|
+
[...customTesters],
|
|
10616
10628
|
[...aStack],
|
|
10617
10629
|
[...bStack]
|
|
10618
10630
|
);
|
|
@@ -10690,7 +10702,7 @@ function subsetEquality(object2, subset, customTesters = []) {
|
|
|
10690
10702
|
if (!isObjectWithKeys(subset2))
|
|
10691
10703
|
return void 0;
|
|
10692
10704
|
return Object.keys(subset2).every((key) => {
|
|
10693
|
-
if (
|
|
10705
|
+
if (typeof subset2[key] === "object") {
|
|
10694
10706
|
if (seenReferences.has(subset2[key]))
|
|
10695
10707
|
return equals(object22[key], subset2[key], filteredCustomTesters);
|
|
10696
10708
|
seenReferences.set(subset2[key], true);
|
|
@@ -10754,6 +10766,57 @@ Received: serializes to the same string
|
|
|
10754
10766
|
function pluralize(word, count) {
|
|
10755
10767
|
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
10756
10768
|
}
|
|
10769
|
+
function getObjectKeys(object2) {
|
|
10770
|
+
return [
|
|
10771
|
+
...Object.keys(object2),
|
|
10772
|
+
...Object.getOwnPropertySymbols(object2).filter(
|
|
10773
|
+
(s) => {
|
|
10774
|
+
var _a2;
|
|
10775
|
+
return (_a2 = Object.getOwnPropertyDescriptor(object2, s)) == null ? void 0 : _a2.enumerable;
|
|
10776
|
+
}
|
|
10777
|
+
)
|
|
10778
|
+
];
|
|
10779
|
+
}
|
|
10780
|
+
function getObjectSubset(object2, subset, customTesters = []) {
|
|
10781
|
+
let stripped = 0;
|
|
10782
|
+
const getObjectSubsetWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object22, subset2) => {
|
|
10783
|
+
if (Array.isArray(object22)) {
|
|
10784
|
+
if (Array.isArray(subset2) && subset2.length === object22.length) {
|
|
10785
|
+
return subset2.map(
|
|
10786
|
+
(sub, i2) => getObjectSubsetWithContext(seenReferences)(object22[i2], sub)
|
|
10787
|
+
);
|
|
10788
|
+
}
|
|
10789
|
+
} else if (object22 instanceof Date) {
|
|
10790
|
+
return object22;
|
|
10791
|
+
} else if (isObject(object22) && isObject(subset2)) {
|
|
10792
|
+
if (equals(object22, subset2, [
|
|
10793
|
+
...customTesters,
|
|
10794
|
+
iterableEquality,
|
|
10795
|
+
subsetEquality
|
|
10796
|
+
])) {
|
|
10797
|
+
return subset2;
|
|
10798
|
+
}
|
|
10799
|
+
const trimmed = {};
|
|
10800
|
+
seenReferences.set(object22, trimmed);
|
|
10801
|
+
for (const key of getObjectKeys(object22)) {
|
|
10802
|
+
if (hasPropertyInObject(subset2, key)) {
|
|
10803
|
+
trimmed[key] = seenReferences.has(object22[key]) ? seenReferences.get(object22[key]) : getObjectSubsetWithContext(seenReferences)(object22[key], subset2[key]);
|
|
10804
|
+
} else {
|
|
10805
|
+
if (!seenReferences.has(object22[key])) {
|
|
10806
|
+
stripped += 1;
|
|
10807
|
+
if (isObject(object22[key]))
|
|
10808
|
+
stripped += getObjectKeys(object22[key]).length;
|
|
10809
|
+
getObjectSubsetWithContext(seenReferences)(object22[key], subset2[key]);
|
|
10810
|
+
}
|
|
10811
|
+
}
|
|
10812
|
+
}
|
|
10813
|
+
if (getObjectKeys(trimmed).length > 0)
|
|
10814
|
+
return trimmed;
|
|
10815
|
+
}
|
|
10816
|
+
return object22;
|
|
10817
|
+
};
|
|
10818
|
+
return { subset: getObjectSubsetWithContext()(object2, subset), stripped };
|
|
10819
|
+
}
|
|
10757
10820
|
var AsymmetricMatcher3 = class {
|
|
10758
10821
|
constructor(sample, inverse = false) {
|
|
10759
10822
|
this.sample = sample;
|
|
@@ -11181,16 +11244,30 @@ var JestChaiExpect = (chai3, utils) => {
|
|
|
11181
11244
|
});
|
|
11182
11245
|
def("toMatchObject", function(expected) {
|
|
11183
11246
|
const actual = this._obj;
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11247
|
+
const pass = equals(actual, expected, [...customTesters, iterableEquality, subsetEquality]);
|
|
11248
|
+
const isNot = utils.flag(this, "negate");
|
|
11249
|
+
const { subset: actualSubset, stripped } = getObjectSubset(actual, expected);
|
|
11250
|
+
if (pass && isNot || !pass && !isNot) {
|
|
11251
|
+
const msg = utils.getMessage(
|
|
11252
|
+
this,
|
|
11253
|
+
[
|
|
11254
|
+
pass,
|
|
11255
|
+
"expected #{this} to match object #{exp}",
|
|
11256
|
+
"expected #{this} to not match object #{exp}",
|
|
11257
|
+
expected,
|
|
11258
|
+
actualSubset,
|
|
11259
|
+
false
|
|
11260
|
+
]
|
|
11261
|
+
);
|
|
11262
|
+
const message = stripped === 0 ? msg : `${msg}
|
|
11263
|
+
(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
|
|
11264
|
+
throw new AssertionError2(message, { showDiff: true, expected, actual: actualSubset });
|
|
11265
|
+
}
|
|
11191
11266
|
});
|
|
11192
11267
|
def("toMatch", function(expected) {
|
|
11193
11268
|
const actual = this._obj;
|
|
11269
|
+
if (typeof actual !== "string")
|
|
11270
|
+
throw new TypeError(`.toMatch() expects to receive a string, but got ${typeof actual}`);
|
|
11194
11271
|
return this.assert(
|
|
11195
11272
|
typeof expected === "string" ? actual.includes(expected) : actual.match(expected),
|
|
11196
11273
|
`expected #{this} to match #{exp}`,
|
|
@@ -11532,12 +11609,15 @@ Number of calls: ${c2().bold(spy.mock.calls.length)}
|
|
|
11532
11609
|
const spy = getSpy(this);
|
|
11533
11610
|
const spyName = spy.getMockName();
|
|
11534
11611
|
const nthCall = spy.mock.calls[times - 1];
|
|
11612
|
+
const callCount = spy.mock.calls.length;
|
|
11613
|
+
const isCalled = times <= callCount;
|
|
11535
11614
|
this.assert(
|
|
11536
11615
|
equals(nthCall, args, [...customTesters, iterableEquality]),
|
|
11537
|
-
`expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}`,
|
|
11616
|
+
`expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`,
|
|
11538
11617
|
`expected ${ordinalOf(times)} "${spyName}" call to not have been called with #{exp}`,
|
|
11539
11618
|
args,
|
|
11540
|
-
nthCall
|
|
11619
|
+
nthCall,
|
|
11620
|
+
isCalled
|
|
11541
11621
|
);
|
|
11542
11622
|
});
|
|
11543
11623
|
def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
|
|
@@ -13308,7 +13388,7 @@ function resetDate() {
|
|
|
13308
13388
|
globalThis.Date = RealDate;
|
|
13309
13389
|
}
|
|
13310
13390
|
|
|
13311
|
-
// ../../node_modules/vitest/dist/vendor/vi.
|
|
13391
|
+
// ../../node_modules/vitest/dist/vendor/vi.Y_w82WR8.js
|
|
13312
13392
|
function resetModules(modules, resetMocks = false) {
|
|
13313
13393
|
const skipPaths = [
|
|
13314
13394
|
// Vitest
|
|
@@ -15433,12 +15513,14 @@ function createVitest() {
|
|
|
15433
15513
|
let _mockedDate = null;
|
|
15434
15514
|
let _config = null;
|
|
15435
15515
|
const workerState = getWorkerState();
|
|
15436
|
-
|
|
15516
|
+
let _timers;
|
|
15517
|
+
const timers = () => _timers || (_timers = new FakeTimers({
|
|
15437
15518
|
global: globalThis,
|
|
15438
15519
|
config: workerState.config.fakeTimers
|
|
15439
|
-
});
|
|
15520
|
+
}));
|
|
15440
15521
|
const _stubsGlobal = /* @__PURE__ */ new Map();
|
|
15441
15522
|
const _stubsEnv = /* @__PURE__ */ new Map();
|
|
15523
|
+
const _envBooleans = ["PROD", "DEV", "SSR"];
|
|
15442
15524
|
const getImporter = () => {
|
|
15443
15525
|
const stackTrace = createSimpleStackTrace({ stackTraceLimit: 4 });
|
|
15444
15526
|
const importerStack = stackTrace.split("\n")[4];
|
|
@@ -15456,73 +15538,73 @@ function createVitest() {
|
|
|
15456
15538
|
}
|
|
15457
15539
|
}
|
|
15458
15540
|
if (config2)
|
|
15459
|
-
|
|
15541
|
+
timers().configure({ ...workerState.config.fakeTimers, ...config2 });
|
|
15460
15542
|
else
|
|
15461
|
-
|
|
15462
|
-
|
|
15543
|
+
timers().configure(workerState.config.fakeTimers);
|
|
15544
|
+
timers().useFakeTimers();
|
|
15463
15545
|
return utils;
|
|
15464
15546
|
},
|
|
15465
15547
|
isFakeTimers() {
|
|
15466
|
-
return
|
|
15548
|
+
return timers().isFakeTimers();
|
|
15467
15549
|
},
|
|
15468
15550
|
useRealTimers() {
|
|
15469
|
-
|
|
15551
|
+
timers().useRealTimers();
|
|
15470
15552
|
_mockedDate = null;
|
|
15471
15553
|
return utils;
|
|
15472
15554
|
},
|
|
15473
15555
|
runOnlyPendingTimers() {
|
|
15474
|
-
|
|
15556
|
+
timers().runOnlyPendingTimers();
|
|
15475
15557
|
return utils;
|
|
15476
15558
|
},
|
|
15477
15559
|
async runOnlyPendingTimersAsync() {
|
|
15478
|
-
await
|
|
15560
|
+
await timers().runOnlyPendingTimersAsync();
|
|
15479
15561
|
return utils;
|
|
15480
15562
|
},
|
|
15481
15563
|
runAllTimers() {
|
|
15482
|
-
|
|
15564
|
+
timers().runAllTimers();
|
|
15483
15565
|
return utils;
|
|
15484
15566
|
},
|
|
15485
15567
|
async runAllTimersAsync() {
|
|
15486
|
-
await
|
|
15568
|
+
await timers().runAllTimersAsync();
|
|
15487
15569
|
return utils;
|
|
15488
15570
|
},
|
|
15489
15571
|
runAllTicks() {
|
|
15490
|
-
|
|
15572
|
+
timers().runAllTicks();
|
|
15491
15573
|
return utils;
|
|
15492
15574
|
},
|
|
15493
15575
|
advanceTimersByTime(ms) {
|
|
15494
|
-
|
|
15576
|
+
timers().advanceTimersByTime(ms);
|
|
15495
15577
|
return utils;
|
|
15496
15578
|
},
|
|
15497
15579
|
async advanceTimersByTimeAsync(ms) {
|
|
15498
|
-
await
|
|
15580
|
+
await timers().advanceTimersByTimeAsync(ms);
|
|
15499
15581
|
return utils;
|
|
15500
15582
|
},
|
|
15501
15583
|
advanceTimersToNextTimer() {
|
|
15502
|
-
|
|
15584
|
+
timers().advanceTimersToNextTimer();
|
|
15503
15585
|
return utils;
|
|
15504
15586
|
},
|
|
15505
15587
|
async advanceTimersToNextTimerAsync() {
|
|
15506
|
-
await
|
|
15588
|
+
await timers().advanceTimersToNextTimerAsync();
|
|
15507
15589
|
return utils;
|
|
15508
15590
|
},
|
|
15509
15591
|
getTimerCount() {
|
|
15510
|
-
return
|
|
15592
|
+
return timers().getTimerCount();
|
|
15511
15593
|
},
|
|
15512
15594
|
setSystemTime(time) {
|
|
15513
15595
|
const date = time instanceof Date ? time : new Date(time);
|
|
15514
15596
|
_mockedDate = date;
|
|
15515
|
-
|
|
15597
|
+
timers().setSystemTime(date);
|
|
15516
15598
|
return utils;
|
|
15517
15599
|
},
|
|
15518
15600
|
getMockedSystemTime() {
|
|
15519
15601
|
return _mockedDate;
|
|
15520
15602
|
},
|
|
15521
15603
|
getRealSystemTime() {
|
|
15522
|
-
return
|
|
15604
|
+
return timers().getRealSystemTime();
|
|
15523
15605
|
},
|
|
15524
15606
|
clearAllTimers() {
|
|
15525
|
-
|
|
15607
|
+
timers().clearAllTimers();
|
|
15526
15608
|
return utils;
|
|
15527
15609
|
},
|
|
15528
15610
|
// mocks
|
|
@@ -15601,7 +15683,10 @@ function createVitest() {
|
|
|
15601
15683
|
stubEnv(name, value) {
|
|
15602
15684
|
if (!_stubsEnv.has(name))
|
|
15603
15685
|
_stubsEnv.set(name, process.env[name]);
|
|
15604
|
-
|
|
15686
|
+
if (_envBooleans.includes(name))
|
|
15687
|
+
process.env[name] = value ? "1" : "";
|
|
15688
|
+
else
|
|
15689
|
+
process.env[name] = String(value);
|
|
15605
15690
|
return utils;
|
|
15606
15691
|
},
|
|
15607
15692
|
unstubAllGlobals() {
|
|
@@ -15646,7 +15731,7 @@ function createVitest() {
|
|
|
15646
15731
|
var vitest = createVitest();
|
|
15647
15732
|
var vi = vitest;
|
|
15648
15733
|
|
|
15649
|
-
// ../../node_modules/vitest/dist/vendor/index.
|
|
15734
|
+
// ../../node_modules/vitest/dist/vendor/index.0RrMQKD8.js
|
|
15650
15735
|
init_cjs_shims();
|
|
15651
15736
|
function getRunningMode() {
|
|
15652
15737
|
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|