vitest 0.24.4 → 0.24.5

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.
Files changed (25) hide show
  1. package/dist/browser.js +8 -7
  2. package/dist/{chunk-api-setup.5a197c69.js → chunk-api-setup.629f8133.js} +4 -4
  3. package/dist/{chunk-integrations-globals.88fd2e64.js → chunk-integrations-globals.32ef80c3.js} +6 -6
  4. package/dist/{chunk-mock-date.9fe2b438.js → chunk-mock-date.030959d3.js} +1 -1
  5. package/dist/{chunk-runtime-chain.a5cd236b.js → chunk-runtime-chain.37ec5d73.js} +4 -4
  6. package/dist/chunk-runtime-error.17751c39.js +135 -0
  7. package/dist/{chunk-runtime-hooks.66004497.js → chunk-runtime-hooks.d748b085.js} +4 -4
  8. package/dist/{chunk-runtime-mocker.f994e23a.js → chunk-runtime-mocker.41b92ec9.js} +3 -3
  9. package/dist/chunk-runtime-rpc.b418c0ab.js +30 -0
  10. package/dist/{chunk-runtime-error.9c28c08f.js → chunk-runtime-setup.ab6b6274.js} +11 -142
  11. package/dist/chunk-utils-source-map.663e2952.js +3429 -0
  12. package/dist/{chunk-utils-source-map.d9d36eb0.js → chunk-utils-timers.8fca243e.js} +19 -3439
  13. package/dist/{chunk-vite-node-client.9fbd5d5b.js → chunk-vite-node-client.3868b3ba.js} +1 -1
  14. package/dist/{chunk-vite-node-externalize.e66d46f6.js → chunk-vite-node-externalize.d9033432.js} +11 -13
  15. package/dist/{chunk-vite-node-utils.5096a80d.js → chunk-vite-node-utils.2144000e.js} +3 -9
  16. package/dist/cli.js +6 -6
  17. package/dist/entry.js +8 -7
  18. package/dist/index.js +6 -6
  19. package/dist/loader.js +2 -2
  20. package/dist/node.js +7 -7
  21. package/dist/suite.js +5 -5
  22. package/dist/worker.js +9 -7
  23. package/package.json +3 -3
  24. package/dist/chunk-runtime-rpc.e583f5e7.js +0 -16
  25. package/dist/chunk-utils-timers.ab764c0c.js +0 -27
package/dist/browser.js CHANGED
@@ -1,24 +1,25 @@
1
- export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.a5cd236b.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.66004497.js';
3
- export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.9c28c08f.js';
1
+ export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.37ec5d73.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.d748b085.js';
3
+ export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.ab6b6274.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
7
7
  import 'util';
8
- import './chunk-mock-date.9fe2b438.js';
8
+ import './chunk-mock-date.030959d3.js';
9
9
  import 'path';
10
10
  import './chunk-utils-env.b1281522.js';
11
11
  import 'tty';
12
12
  import 'url';
13
13
  import 'local-pkg';
14
14
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.e583f5e7.js';
16
- import './chunk-utils-timers.ab764c0c.js';
15
+ import './chunk-runtime-rpc.b418c0ab.js';
16
+ import './chunk-utils-timers.8fca243e.js';
17
17
  import 'fs';
18
- import './chunk-utils-source-map.d9d36eb0.js';
18
+ import './chunk-utils-source-map.663e2952.js';
19
19
  import './spy.js';
20
20
  import 'tinyspy';
21
21
  import 'perf_hooks';
22
22
  import './chunk-integrations-coverage.cca09977.js';
23
+ import './chunk-runtime-error.17751c39.js';
23
24
  import './chunk-env-node.700b7e95.js';
24
25
  import 'console';
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-client.9fbd5d5b.js';
2
+ import { c as createBirpc } from './chunk-vite-node-client.3868b3ba.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -10,16 +10,16 @@ import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
12
  import { A as API_PATH } from './chunk-utils-env.b1281522.js';
13
- import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.d9d36eb0.js';
13
+ import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.663e2952.js';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-vite-node-utils.5096a80d.js';
16
+ import './chunk-vite-node-utils.2144000e.js';
17
17
  import 'path';
18
18
  import 'assert';
19
19
  import 'util';
20
20
  import 'debug';
21
21
  import 'tty';
22
- import './chunk-mock-date.9fe2b438.js';
22
+ import './chunk-mock-date.030959d3.js';
23
23
  import 'local-pkg';
24
24
 
25
25
  /*! (c) 2020 Andrea Giammarchi */
@@ -1,18 +1,18 @@
1
1
  import { m as globalApis } from './chunk-utils-env.b1281522.js';
2
- import { i as index } from './chunk-runtime-hooks.66004497.js';
2
+ import { i as index } from './chunk-runtime-hooks.d748b085.js';
3
3
  import 'tty';
4
4
  import 'url';
5
5
  import 'path';
6
- import './chunk-runtime-chain.a5cd236b.js';
6
+ import './chunk-runtime-chain.37ec5d73.js';
7
7
  import 'util';
8
- import './chunk-mock-date.9fe2b438.js';
8
+ import './chunk-mock-date.030959d3.js';
9
9
  import 'local-pkg';
10
10
  import 'chai';
11
11
  import './vendor-_commonjsHelpers.addc3445.js';
12
- import './chunk-runtime-rpc.e583f5e7.js';
13
- import './chunk-utils-timers.ab764c0c.js';
12
+ import './chunk-runtime-rpc.b418c0ab.js';
13
+ import './chunk-utils-timers.8fca243e.js';
14
14
  import 'fs';
15
- import './chunk-utils-source-map.d9d36eb0.js';
15
+ import './chunk-utils-source-map.663e2952.js';
16
16
  import './spy.js';
17
17
  import 'tinyspy';
18
18
 
@@ -326,4 +326,4 @@ function createDefer() {
326
326
  return p;
327
327
  }
328
328
 
329
- export { AggregateErrorPonyfill as A, deepMerge as B, ensurePackageInstalled as C, stdout as D, mergeSlashes as E, getAllMockableProperties as F, RealDate as R, resetModules as a, getCallLastIndex as b, getNames as c, assertTypes as d, getFullName as e, isRunningInTest as f, getWorkerState as g, isRunningInBenchmark as h, isObject as i, notNullish as j, deepClone as k, getType as l, mockDate as m, noop as n, relativePath as o, partitionSuiteChildren as p, shuffle as q, resetDate as r, slash as s, toArray as t, hasTests as u, hasFailed as v, createDefer as w, getTests as x, hasFailedSnapshot as y, getSuites as z };
329
+ export { AggregateErrorPonyfill as A, deepMerge as B, ensurePackageInstalled as C, stdout as D, mergeSlashes as E, getAllMockableProperties as F, RealDate as R, resetModules as a, getCallLastIndex as b, getNames as c, assertTypes as d, getFullName as e, isRunningInTest as f, getWorkerState as g, isRunningInBenchmark as h, isObject as i, notNullish as j, relativePath as k, shuffle as l, mockDate as m, noop as n, hasTests as o, partitionSuiteChildren as p, hasFailed as q, resetDate as r, slash as s, toArray as t, createDefer as u, deepClone as v, getType as w, getTests as x, hasFailedSnapshot as y, getSuites as z };
@@ -1,14 +1,14 @@
1
1
  import util$1 from 'util';
2
- import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.9fe2b438.js';
2
+ import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-mock-date.030959d3.js';
3
3
  import * as chai$2 from 'chai';
4
4
  import { expect, AssertionError, util } from 'chai';
5
5
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
6
- import { r as rpc } from './chunk-runtime-rpc.e583f5e7.js';
6
+ import { r as rpc } from './chunk-runtime-rpc.b418c0ab.js';
7
7
  import fs, { promises } from 'fs';
8
8
  import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.b1281522.js';
9
- import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.d9d36eb0.js';
9
+ import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.8fca243e.js';
10
+ import { g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.663e2952.js';
10
11
  import { isMockFunction } from './spy.js';
11
- import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.ab764c0c.js';
12
12
 
13
13
  function createChainable(keys, fn) {
14
14
  function create(context) {
@@ -0,0 +1,135 @@
1
+ import util$1 from 'util';
2
+ import { util } from 'chai';
3
+ import { a as stringify } from './chunk-utils-timers.8fca243e.js';
4
+ import { v as deepClone, w as getType } from './chunk-mock-date.030959d3.js';
5
+
6
+ const OBJECT_PROTO = Object.getPrototypeOf({});
7
+ function getUnserializableMessage(err) {
8
+ if (err instanceof Error)
9
+ return `<unserializable>: ${err.message}`;
10
+ if (typeof err === "string")
11
+ return `<unserializable>: ${err}`;
12
+ return "<unserializable>";
13
+ }
14
+ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
15
+ if (!val || typeof val === "string")
16
+ return val;
17
+ if (typeof val === "function")
18
+ return `Function<${val.name}>`;
19
+ if (typeof val !== "object")
20
+ return val;
21
+ if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction")
22
+ return "Promise";
23
+ if (typeof Element !== "undefined" && val instanceof Element)
24
+ return val.tagName;
25
+ if (typeof val.asymmetricMatch === "function")
26
+ return `${val.toString()} ${util$1.format(val.sample)}`;
27
+ if (seen.has(val))
28
+ return seen.get(val);
29
+ if (Array.isArray(val)) {
30
+ const clone = new Array(val.length);
31
+ seen.set(val, clone);
32
+ val.forEach((e, i) => {
33
+ try {
34
+ clone[i] = serializeError(e, seen);
35
+ } catch (err) {
36
+ clone[i] = getUnserializableMessage(err);
37
+ }
38
+ });
39
+ return clone;
40
+ } else {
41
+ const clone = /* @__PURE__ */ Object.create(null);
42
+ seen.set(val, clone);
43
+ let obj = val;
44
+ while (obj && obj !== OBJECT_PROTO) {
45
+ Object.getOwnPropertyNames(obj).forEach((key) => {
46
+ if (key in clone)
47
+ return;
48
+ try {
49
+ clone[key] = serializeError(val[key], seen);
50
+ } catch (err) {
51
+ delete clone[key];
52
+ clone[key] = getUnserializableMessage(err);
53
+ }
54
+ });
55
+ obj = Object.getPrototypeOf(obj);
56
+ }
57
+ return clone;
58
+ }
59
+ }
60
+ function normalizeErrorMessage(message) {
61
+ return message.replace(/__vite_ssr_import_\d+__\./g, "");
62
+ }
63
+ function processError(err) {
64
+ if (!err || typeof err !== "object")
65
+ return err;
66
+ if (err.stack)
67
+ err.stackStr = String(err.stack);
68
+ if (err.name)
69
+ err.nameStr = String(err.name);
70
+ const clonedActual = deepClone(err.actual);
71
+ const clonedExpected = deepClone(err.expected);
72
+ const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
73
+ err.actual = replacedActual;
74
+ err.expected = replacedExpected;
75
+ if (typeof err.expected !== "string")
76
+ err.expected = stringify(err.expected);
77
+ if (typeof err.actual !== "string")
78
+ err.actual = stringify(err.actual);
79
+ try {
80
+ if (typeof err.message === "string")
81
+ err.message = normalizeErrorMessage(err.message);
82
+ if (typeof err.cause === "object" && typeof err.cause.message === "string")
83
+ err.cause.message = normalizeErrorMessage(err.cause.message);
84
+ } catch {
85
+ }
86
+ try {
87
+ return serializeError(err);
88
+ } catch (e) {
89
+ return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}
90
+ Inner error message: ${err == null ? void 0 : err.message}`));
91
+ }
92
+ }
93
+ function isAsymmetricMatcher(data) {
94
+ const type = getType(data);
95
+ return type === "Object" && typeof data.asymmetricMatch === "function";
96
+ }
97
+ function isReplaceable(obj1, obj2) {
98
+ const obj1Type = getType(obj1);
99
+ const obj2Type = getType(obj2);
100
+ return obj1Type === obj2Type && obj1Type === "Object";
101
+ }
102
+ function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakMap(), expectedReplaced = /* @__PURE__ */ new WeakMap()) {
103
+ if (!isReplaceable(actual, expected))
104
+ return { replacedActual: actual, replacedExpected: expected };
105
+ if (actualReplaced.has(actual) || expectedReplaced.has(expected))
106
+ return { replacedActual: actual, replacedExpected: expected };
107
+ actualReplaced.set(actual, true);
108
+ expectedReplaced.set(expected, true);
109
+ util.getOwnEnumerableProperties(expected).forEach((key) => {
110
+ const expectedValue = expected[key];
111
+ const actualValue = actual[key];
112
+ if (isAsymmetricMatcher(expectedValue)) {
113
+ if (expectedValue.asymmetricMatch(actualValue))
114
+ actual[key] = expectedValue;
115
+ } else if (isAsymmetricMatcher(actualValue)) {
116
+ if (actualValue.asymmetricMatch(expectedValue))
117
+ expected[key] = actualValue;
118
+ } else if (isReplaceable(actualValue, expectedValue)) {
119
+ const replaced = replaceAsymmetricMatcher(
120
+ actualValue,
121
+ expectedValue,
122
+ actualReplaced,
123
+ expectedReplaced
124
+ );
125
+ actual[key] = replaced.replacedActual;
126
+ expected[key] = replaced.replacedExpected;
127
+ }
128
+ });
129
+ return {
130
+ replacedActual: actual,
131
+ replacedExpected: expected
132
+ };
133
+ }
134
+
135
+ export { processError as p };
@@ -1,10 +1,10 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.a5cd236b.js';
2
- import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.9fe2b438.js';
3
- import { p as parseStacktrace } from './chunk-utils-source-map.d9d36eb0.js';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.37ec5d73.js';
2
+ import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.030959d3.js';
3
+ import { p as parseStacktrace } from './chunk-utils-source-map.663e2952.js';
4
4
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
5
5
  import util from 'util';
6
6
  import { spyOn, fn, isMockFunction, spies } from './spy.js';
7
- import { s as safeSetTimeout } from './chunk-utils-timers.ab764c0c.js';
7
+ import { s as safeSetTimeout } from './chunk-utils-timers.8fca243e.js';
8
8
  import * as chai from 'chai';
9
9
  import { assert, should } from 'chai';
10
10
 
@@ -1,8 +1,8 @@
1
- import { V as ViteNodeRunner } from './chunk-vite-node-client.9fbd5d5b.js';
1
+ import { V as ViteNodeRunner } from './chunk-vite-node-client.3868b3ba.js';
2
2
  import { normalizePath } from 'vite';
3
- import { g as getWorkerState, E as mergeSlashes, s as slash, l as getType, F as getAllMockableProperties } from './chunk-mock-date.9fe2b438.js';
3
+ import { g as getWorkerState, E as mergeSlashes, s as slash, w as getType, F as getAllMockableProperties } from './chunk-mock-date.030959d3.js';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.5096a80d.js';
5
+ import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.2144000e.js';
6
6
  import { d as dirname, j as join, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.b1281522.js';
7
7
 
8
8
  class RefTracker {
@@ -0,0 +1,30 @@
1
+ import { g as getWorkerState } from './chunk-mock-date.030959d3.js';
2
+ import { s as safeSetTimeout } from './chunk-utils-timers.8fca243e.js';
3
+
4
+ const safeRandom = Math.random;
5
+ function withSafeTimers(fn) {
6
+ const currentSetTimeout = globalThis.setTimeout;
7
+ const currentRandom = globalThis.Math.random;
8
+ try {
9
+ globalThis.setTimeout = safeSetTimeout;
10
+ globalThis.Math.random = safeRandom;
11
+ const result = fn();
12
+ return result;
13
+ } finally {
14
+ globalThis.setTimeout = currentSetTimeout;
15
+ globalThis.Math.random = currentRandom;
16
+ }
17
+ }
18
+ const rpc = () => {
19
+ const { rpc: rpc2 } = getWorkerState();
20
+ return new Proxy(rpc2, {
21
+ get(target, p, handler) {
22
+ const sendCall = Reflect.get(target, p, handler);
23
+ const safeSendCall = (...args) => withSafeTimers(() => sendCall(...args));
24
+ safeSendCall.asEvent = sendCall.asEvent;
25
+ return safeSendCall;
26
+ }
27
+ });
28
+ };
29
+
30
+ export { rpc as r };
@@ -1,144 +1,13 @@
1
1
  import { performance } from 'perf_hooks';
2
2
  import { t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.cca09977.js';
3
- import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.66004497.js';
4
- import { k as deepClone, l as getType, g as getWorkerState, R as RealDate, t as toArray, o as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, q as shuffle, u as hasTests, v as hasFailed, w as createDefer, d as assertTypes, e as getFullName } from './chunk-mock-date.9fe2b438.js';
5
- import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.a5cd236b.js';
6
- import { r as rpc } from './chunk-runtime-rpc.e583f5e7.js';
7
- import util$1 from 'util';
8
- import { util } from 'chai';
9
- import { s as stringify } from './chunk-utils-source-map.d9d36eb0.js';
3
+ import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.d748b085.js';
4
+ import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, o as hasTests, q as hasFailed, u as createDefer, d as assertTypes, e as getFullName } from './chunk-mock-date.030959d3.js';
5
+ import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.37ec5d73.js';
6
+ import { r as rpc } from './chunk-runtime-rpc.b418c0ab.js';
7
+ import { p as processError } from './chunk-runtime-error.17751c39.js';
10
8
  import { e as environments } from './chunk-env-node.700b7e95.js';
11
9
  import { i as isNode, a as isBrowser } from './chunk-utils-env.b1281522.js';
12
- import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.ab764c0c.js';
13
-
14
- const OBJECT_PROTO = Object.getPrototypeOf({});
15
- function getUnserializableMessage(err) {
16
- if (err instanceof Error)
17
- return `<unserializable>: ${err.message}`;
18
- if (typeof err === "string")
19
- return `<unserializable>: ${err}`;
20
- return "<unserializable>";
21
- }
22
- function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
23
- if (!val || typeof val === "string")
24
- return val;
25
- if (typeof val === "function")
26
- return `Function<${val.name}>`;
27
- if (typeof val !== "object")
28
- return val;
29
- if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction")
30
- return "Promise";
31
- if (typeof Element !== "undefined" && val instanceof Element)
32
- return val.tagName;
33
- if (typeof val.asymmetricMatch === "function")
34
- return `${val.toString()} ${util$1.format(val.sample)}`;
35
- if (seen.has(val))
36
- return seen.get(val);
37
- if (Array.isArray(val)) {
38
- const clone = new Array(val.length);
39
- seen.set(val, clone);
40
- val.forEach((e, i) => {
41
- try {
42
- clone[i] = serializeError(e, seen);
43
- } catch (err) {
44
- clone[i] = getUnserializableMessage(err);
45
- }
46
- });
47
- return clone;
48
- } else {
49
- const clone = /* @__PURE__ */ Object.create(null);
50
- seen.set(val, clone);
51
- let obj = val;
52
- while (obj && obj !== OBJECT_PROTO) {
53
- Object.getOwnPropertyNames(obj).forEach((key) => {
54
- if (key in clone)
55
- return;
56
- try {
57
- clone[key] = serializeError(obj[key], seen);
58
- } catch (err) {
59
- delete clone[key];
60
- clone[key] = getUnserializableMessage(err);
61
- }
62
- });
63
- obj = Object.getPrototypeOf(obj);
64
- }
65
- return clone;
66
- }
67
- }
68
- function normalizeErrorMessage(message) {
69
- return message.replace(/__vite_ssr_import_\d+__\./g, "");
70
- }
71
- function processError(err) {
72
- if (!err || typeof err !== "object")
73
- return err;
74
- if (err.stack)
75
- err.stackStr = String(err.stack);
76
- if (err.name)
77
- err.nameStr = String(err.name);
78
- const clonedActual = deepClone(err.actual);
79
- const clonedExpected = deepClone(err.expected);
80
- const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
81
- err.actual = replacedActual;
82
- err.expected = replacedExpected;
83
- if (typeof err.expected !== "string")
84
- err.expected = stringify(err.expected);
85
- if (typeof err.actual !== "string")
86
- err.actual = stringify(err.actual);
87
- try {
88
- if (typeof err.message === "string")
89
- err.message = normalizeErrorMessage(err.message);
90
- if (typeof err.cause === "object" && typeof err.cause.message === "string")
91
- err.cause.message = normalizeErrorMessage(err.cause.message);
92
- } catch {
93
- }
94
- try {
95
- return serializeError(err);
96
- } catch (e) {
97
- return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}
98
- Inner error message: ${err == null ? void 0 : err.message}`));
99
- }
100
- }
101
- function isAsymmetricMatcher(data) {
102
- const type = getType(data);
103
- return type === "Object" && typeof data.asymmetricMatch === "function";
104
- }
105
- function isReplaceable(obj1, obj2) {
106
- const obj1Type = getType(obj1);
107
- const obj2Type = getType(obj2);
108
- return obj1Type === obj2Type && obj1Type === "Object";
109
- }
110
- function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakMap(), expectedReplaced = /* @__PURE__ */ new WeakMap()) {
111
- if (!isReplaceable(actual, expected))
112
- return { replacedActual: actual, replacedExpected: expected };
113
- if (actualReplaced.has(actual) || expectedReplaced.has(expected))
114
- return { replacedActual: actual, replacedExpected: expected };
115
- actualReplaced.set(actual, true);
116
- expectedReplaced.set(expected, true);
117
- util.getOwnEnumerableProperties(expected).forEach((key) => {
118
- const expectedValue = expected[key];
119
- const actualValue = actual[key];
120
- if (isAsymmetricMatcher(expectedValue)) {
121
- if (expectedValue.asymmetricMatch(actualValue))
122
- actual[key] = expectedValue;
123
- } else if (isAsymmetricMatcher(actualValue)) {
124
- if (actualValue.asymmetricMatch(expectedValue))
125
- expected[key] = actualValue;
126
- } else if (isReplaceable(actualValue, expectedValue)) {
127
- const replaced = replaceAsymmetricMatcher(
128
- actualValue,
129
- expectedValue,
130
- actualReplaced,
131
- expectedReplaced
132
- );
133
- actual[key] = replaced.replacedActual;
134
- expected[key] = replaced.replacedExpected;
135
- }
136
- });
137
- return {
138
- replacedActual: actual,
139
- replacedExpected: expected
140
- };
141
- }
10
+ import { b as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.8fca243e.js';
142
11
 
143
12
  let globalSetup = false;
144
13
  async function setupGlobalEnv(config) {
@@ -155,7 +24,7 @@ async function setupGlobalEnv(config) {
155
24
  if (isNode)
156
25
  await setupConsoleLogSpy();
157
26
  if (config.globals)
158
- (await import('./chunk-integrations-globals.88fd2e64.js')).registerApiGlobally();
27
+ (await import('./chunk-integrations-globals.32ef80c3.js')).registerApiGlobally();
159
28
  }
160
29
  function setupDefines(defines) {
161
30
  for (const key in defines)
@@ -499,7 +368,7 @@ const callCleanupHooks = async (cleanups) => {
499
368
  async function runTest(test) {
500
369
  var _a, _b;
501
370
  if (test.mode !== "run") {
502
- const { getSnapshotClient } = await import('./chunk-runtime-chain.a5cd236b.js').then(function (n) { return n.q; });
371
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.37ec5d73.js').then(function (n) { return n.q; });
503
372
  getSnapshotClient().skipTestSnapshots(test);
504
373
  return;
505
374
  }
@@ -515,7 +384,7 @@ async function runTest(test) {
515
384
  updateTask(test);
516
385
  clearModuleMocks();
517
386
  if (isNode) {
518
- const { getSnapshotClient } = await import('./chunk-runtime-chain.a5cd236b.js').then(function (n) { return n.q; });
387
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.37ec5d73.js').then(function (n) { return n.q; });
519
388
  await getSnapshotClient().setTest(test);
520
389
  }
521
390
  const workerState = getWorkerState();
@@ -575,7 +444,7 @@ async function runTest(test) {
575
444
  if (isBrowser && test.result.error)
576
445
  console.error(test.result.error.message, test.result.error.stackStr);
577
446
  if (isNode) {
578
- const { getSnapshotClient } = await import('./chunk-runtime-chain.a5cd236b.js').then(function (n) { return n.q; });
447
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.37ec5d73.js').then(function (n) { return n.q; });
579
448
  getSnapshotClient().clearTest();
580
449
  }
581
450
  test.result.duration = now() - start;
@@ -780,7 +649,7 @@ async function startTestsBrowser(paths, config) {
780
649
  async function startTestsNode(paths, config) {
781
650
  const files = await collectTests(paths, config);
782
651
  rpc().onCollected(files);
783
- const { getSnapshotClient } = await import('./chunk-runtime-chain.a5cd236b.js').then(function (n) { return n.q; });
652
+ const { getSnapshotClient } = await import('./chunk-runtime-chain.37ec5d73.js').then(function (n) { return n.q; });
784
653
  getSnapshotClient().clear();
785
654
  await runFiles(files, config);
786
655
  const coverage = await takeCoverageInsideWorker(config.coverage);