vitest 0.14.1 → 0.14.2
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/dist/{chunk-api-setup.7945baf8.mjs → chunk-api-setup.aa092488.mjs} +4 -4
- package/dist/{chunk-constants.41584d81.mjs → chunk-constants.da1921b9.mjs} +1 -1
- package/dist/{chunk-defaults.a820faeb.mjs → chunk-defaults.45dc5e3d.mjs} +1 -1
- package/dist/{chunk-install-pkg.6f5930c3.mjs → chunk-install-pkg.3fa50769.mjs} +1 -1
- package/dist/{chunk-integrations-globals.f0c5e97f.mjs → chunk-integrations-globals.edcc399b.mjs} +7 -7
- package/dist/{chunk-runtime-chain.6a3c6576.mjs → chunk-runtime-chain.52571387.mjs} +40 -7
- package/dist/{chunk-runtime-mocker.7cf95199.mjs → chunk-runtime-mocker.292c0e16.mjs} +3 -3
- package/dist/{chunk-runtime-rpc.44043bb4.mjs → chunk-runtime-rpc.bcd3613c.mjs} +1 -1
- package/dist/{chunk-utils-global.624991bc.mjs → chunk-utils-global.2684ee9f.mjs} +15 -8
- package/dist/{chunk-utils-source-map.4408ba82.mjs → chunk-utils-source-map.790e5c11.mjs} +29 -14
- package/dist/{chunk-vite-node-externalize.d492e389.mjs → chunk-vite-node-externalize.6b27b039.mjs} +21 -14
- package/dist/{chunk-vite-node-utils.d6687931.mjs → chunk-vite-node-utils.b9738a10.mjs} +1 -1
- package/dist/cli.mjs +8 -8
- package/dist/entry.mjs +6 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +4 -0
- package/dist/node.mjs +8 -8
- package/dist/{vendor-entry.93b045ee.mjs → vendor-entry.ba490394.mjs} +27 -21
- package/dist/{vendor-index.a2a385d8.mjs → vendor-index.e5dc6622.mjs} +0 -0
- package/dist/worker.mjs +5 -5
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-utils.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-utils.b9738a10.mjs';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,11 +9,11 @@ import require$$2 from 'events';
|
|
|
9
9
|
import require$$1 from 'https';
|
|
10
10
|
import require$$2$1 from 'http';
|
|
11
11
|
import url from 'url';
|
|
12
|
-
import { A as API_PATH } from './chunk-constants.
|
|
13
|
-
import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.da1921b9.mjs';
|
|
13
|
+
import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.790e5c11.mjs';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-utils-global.
|
|
16
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
17
17
|
import 'tty';
|
|
18
18
|
import 'local-pkg';
|
|
19
19
|
import 'path';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { l as resolve } from './chunk-utils-global.
|
|
2
|
+
import { l as resolve } from './chunk-utils-global.2684ee9f.mjs';
|
|
3
3
|
|
|
4
4
|
const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
|
|
5
5
|
const defaultPort = 51204;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { pathToFileURL } from 'url';
|
|
4
|
-
import { t as toArray, l as resolve } from './chunk-utils-global.
|
|
4
|
+
import { t as toArray, l as resolve } from './chunk-utils-global.2684ee9f.mjs';
|
|
5
5
|
|
|
6
6
|
const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
|
|
7
7
|
const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
|
|
@@ -2,7 +2,7 @@ import path$2 from 'path';
|
|
|
2
2
|
import fs$2 from 'fs';
|
|
3
3
|
import require$$0 from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
|
-
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.
|
|
5
|
+
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.e5dc6622.mjs';
|
|
6
6
|
import require$$0$1 from 'os';
|
|
7
7
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
8
8
|
import 'assert';
|
package/dist/{chunk-integrations-globals.f0c5e97f.mjs → chunk-integrations-globals.edcc399b.mjs}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.
|
|
2
|
-
import { i as index } from './vendor-entry.
|
|
1
|
+
import { g as globalApis } from './chunk-constants.da1921b9.mjs';
|
|
2
|
+
import { i as index } from './vendor-entry.ba490394.mjs';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'fs';
|
|
9
|
-
import './chunk-runtime-chain.
|
|
9
|
+
import './chunk-runtime-chain.52571387.mjs';
|
|
10
10
|
import 'chai';
|
|
11
11
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
13
|
-
import './chunk-utils-source-map.
|
|
12
|
+
import './chunk-runtime-rpc.bcd3613c.mjs';
|
|
13
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
14
14
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
15
15
|
import 'tinyspy';
|
|
16
16
|
import 'util';
|
|
17
|
-
import './chunk-defaults.
|
|
17
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
18
18
|
import 'module';
|
|
19
19
|
|
|
20
20
|
function registerApiGlobally() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
|
|
2
2
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
3
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
-
import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as safeSetTimeout, f as safeClearTimeout, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.
|
|
3
|
+
import { r as rpc } from './chunk-runtime-rpc.bcd3613c.mjs';
|
|
4
|
+
import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as safeSetTimeout, f as safeClearTimeout, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.2684ee9f.mjs';
|
|
5
5
|
import fs, { promises } from 'fs';
|
|
6
|
-
import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.
|
|
6
|
+
import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.790e5c11.mjs';
|
|
7
7
|
import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.674b628e.mjs';
|
|
8
8
|
import require$$0, { format } from 'util';
|
|
9
9
|
|
|
@@ -375,6 +375,18 @@ const sparseArrayEquality = (a, b) => {
|
|
|
375
375
|
const bKeys = Object.keys(b);
|
|
376
376
|
return equals(a, b, [iterableEquality, typeEquality], true) && equals(aKeys, bKeys);
|
|
377
377
|
};
|
|
378
|
+
const generateToBeMessage = (deepEqualityName, expected = "#{this}", actual = "#{exp}") => {
|
|
379
|
+
const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality`;
|
|
380
|
+
if (["toStrictEqual", "toEqual"].includes(deepEqualityName))
|
|
381
|
+
return `${toBeMessage}
|
|
382
|
+
|
|
383
|
+
If it should pass with deep equality, replace "toBe" with "${deepEqualityName}"
|
|
384
|
+
|
|
385
|
+
Expected: ${expected}
|
|
386
|
+
Received: serializes to the same string
|
|
387
|
+
`;
|
|
388
|
+
return toBeMessage;
|
|
389
|
+
};
|
|
378
390
|
|
|
379
391
|
var naturalCompare$1 = {exports: {}};
|
|
380
392
|
|
|
@@ -526,11 +538,15 @@ function normalizeNewlines(string) {
|
|
|
526
538
|
}
|
|
527
539
|
async function saveSnapshotFile(snapshotData, snapshotPath) {
|
|
528
540
|
const snapshots = Object.keys(snapshotData).sort(naturalCompare$1.exports).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
|
|
529
|
-
|
|
530
|
-
await promises.writeFile(snapshotPath, `${writeSnapshotVersion()}
|
|
541
|
+
const content = `${writeSnapshotVersion()}
|
|
531
542
|
|
|
532
543
|
${snapshots.join("\n\n")}
|
|
533
|
-
|
|
544
|
+
`;
|
|
545
|
+
const skipWriting = fs.existsSync(snapshotPath) && await promises.readFile(snapshotPath, "utf8") === content;
|
|
546
|
+
if (skipWriting)
|
|
547
|
+
return;
|
|
548
|
+
ensureDirectoryExists(snapshotPath);
|
|
549
|
+
await promises.writeFile(snapshotPath, content, "utf-8");
|
|
534
550
|
}
|
|
535
551
|
function prepareExpected(expected) {
|
|
536
552
|
function findStartIndent() {
|
|
@@ -1127,7 +1143,24 @@ const JestChaiExpect = (chai, utils) => {
|
|
|
1127
1143
|
});
|
|
1128
1144
|
def("toBe", function(expected) {
|
|
1129
1145
|
const actual = this._obj;
|
|
1130
|
-
|
|
1146
|
+
const pass = Object.is(actual, expected);
|
|
1147
|
+
let deepEqualityName = "";
|
|
1148
|
+
if (!pass) {
|
|
1149
|
+
const toStrictEqualPass = equals(actual, expected, [
|
|
1150
|
+
iterableEquality,
|
|
1151
|
+
typeEquality,
|
|
1152
|
+
sparseArrayEquality,
|
|
1153
|
+
arrayBufferEquality
|
|
1154
|
+
], true);
|
|
1155
|
+
if (toStrictEqualPass) {
|
|
1156
|
+
deepEqualityName = "toStrictEqual";
|
|
1157
|
+
} else {
|
|
1158
|
+
const toEqualPass = equals(actual, expected, [iterableEquality]);
|
|
1159
|
+
if (toEqualPass)
|
|
1160
|
+
deepEqualityName = "toEqual";
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
return this.assert(pass, generateToBeMessage(deepEqualityName), "expected #{this} not to be #{exp} // Object.is equality", expected, actual);
|
|
1131
1164
|
});
|
|
1132
1165
|
def("toMatchObject", function(expected) {
|
|
1133
1166
|
const actual = this._obj;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
1
|
+
import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.b9738a10.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, l as resolve, k as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.
|
|
3
|
+
import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, l as resolve, k as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.2684ee9f.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.da1921b9.mjs';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -290,20 +290,27 @@ function getOwnProperties(obj) {
|
|
|
290
290
|
collectOwnProperties(obj, ownProps);
|
|
291
291
|
return Array.from(ownProps);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
|
|
293
|
+
function deepClone(val) {
|
|
294
|
+
const seen = /* @__PURE__ */ new WeakMap();
|
|
295
|
+
return clone(val, seen);
|
|
296
|
+
}
|
|
297
|
+
function clone(val, seen) {
|
|
298
|
+
let k, out;
|
|
299
|
+
if (seen.has(val))
|
|
300
|
+
return seen.get(val);
|
|
295
301
|
if (Array.isArray(val)) {
|
|
296
302
|
out = Array(k = val.length);
|
|
303
|
+
seen.set(val, out);
|
|
297
304
|
while (k--)
|
|
298
|
-
out[k] = (
|
|
305
|
+
out[k] = clone(val[k], seen);
|
|
299
306
|
return out;
|
|
300
307
|
}
|
|
301
308
|
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
302
309
|
out = Object.create(Object.getPrototypeOf(val));
|
|
310
|
+
seen.set(val, out);
|
|
303
311
|
const props = getOwnProperties(val);
|
|
304
|
-
for (const k2 of props)
|
|
305
|
-
out[k2] = (
|
|
306
|
-
}
|
|
312
|
+
for (const k2 of props)
|
|
313
|
+
out[k2] = clone(val[k2], seen);
|
|
307
314
|
return out;
|
|
308
315
|
}
|
|
309
316
|
return val;
|
|
@@ -459,7 +466,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
459
466
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
460
467
|
});
|
|
461
468
|
if (install) {
|
|
462
|
-
await (await import('./chunk-install-pkg.
|
|
469
|
+
await (await import('./chunk-install-pkg.3fa50769.mjs')).installPackage(dependency, { dev: true });
|
|
463
470
|
process.stderr.write(picocolors.exports.yellow(`
|
|
464
471
|
Package ${dependency} installed, re-run the command to start.
|
|
465
472
|
`));
|
|
@@ -503,4 +510,4 @@ class AggregateErrorPonyfill extends Error {
|
|
|
503
510
|
}
|
|
504
511
|
}
|
|
505
512
|
|
|
506
|
-
export { AggregateErrorPonyfill as A, safeSetInterval as B, safeClearInterval as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M,
|
|
513
|
+
export { AggregateErrorPonyfill as A, safeSetInterval as B, safeClearInterval as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M, deepClone as N, partitionSuiteChildren as O, hasTests as P, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, safeSetTimeout as e, safeClearTimeout as f, getCallLastIndex as g, notNullish as h, isObject as i, join as j, basename as k, resolve as l, isAbsolute as m, noop as n, relative as o, picocolors as p, isNode as q, resetModules as r, slash as s, toArray as t, getTests as u, getFullName as v, withSafeTimers as w, hasFailed as x, hasFailedSnapshot as y, getSuites as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as slash, h as notNullish, p as picocolors } from './chunk-utils-global.
|
|
1
|
+
import { s as slash, h as notNullish, p as picocolors } from './chunk-utils-global.2684ee9f.mjs';
|
|
2
2
|
|
|
3
3
|
var build = {};
|
|
4
4
|
|
|
@@ -5646,8 +5646,6 @@ function getOriginalPos(map, { line, column }) {
|
|
|
5646
5646
|
resolve(null);
|
|
5647
5647
|
});
|
|
5648
5648
|
}
|
|
5649
|
-
const stackFnCallRE = /at (.*) \((.+):(\d+):(\d+)\)$/;
|
|
5650
|
-
const stackBarePathRE = /at ?(.*) (.+):(\d+):(\d+)$/;
|
|
5651
5649
|
async function interpretSourcePos(stackFrames, ctx) {
|
|
5652
5650
|
var _a;
|
|
5653
5651
|
for (const frame of stackFrames) {
|
|
@@ -5669,25 +5667,42 @@ const stackIgnorePatterns = [
|
|
|
5669
5667
|
"/node_modules/tinypool/",
|
|
5670
5668
|
"/node_modules/tinyspy/"
|
|
5671
5669
|
];
|
|
5670
|
+
function extractLocation(urlLike) {
|
|
5671
|
+
if (!urlLike.includes(":"))
|
|
5672
|
+
return [urlLike];
|
|
5673
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
5674
|
+
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
5675
|
+
if (!parts)
|
|
5676
|
+
return [urlLike];
|
|
5677
|
+
return [parts[1], parts[2] || void 0, parts[3] || void 0];
|
|
5678
|
+
}
|
|
5672
5679
|
function parseStacktrace(e, full = false) {
|
|
5673
5680
|
if (e.stacks)
|
|
5674
5681
|
return e.stacks;
|
|
5675
5682
|
const stackStr = e.stack || e.stackStr || "";
|
|
5676
5683
|
const stackFrames = stackStr.split("\n").map((raw) => {
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5684
|
+
let line = raw.trim();
|
|
5685
|
+
if (line.includes("(eval "))
|
|
5686
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
5687
|
+
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
|
|
5688
|
+
const location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
5689
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
5690
|
+
const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
|
|
5691
|
+
let method = location && sanitizedLine || "";
|
|
5692
|
+
let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
|
|
5693
|
+
if (!file || !lineNumber || !columnNumber)
|
|
5680
5694
|
return null;
|
|
5681
|
-
|
|
5695
|
+
if (method.startsWith("async "))
|
|
5696
|
+
method = method.slice(6);
|
|
5682
5697
|
if (file.startsWith("file://"))
|
|
5683
5698
|
file = file.slice(7);
|
|
5684
|
-
if (!full && stackIgnorePatterns.some((p) => file.includes(p)))
|
|
5699
|
+
if (!full && stackIgnorePatterns.some((p) => file && file.includes(p)))
|
|
5685
5700
|
return null;
|
|
5686
5701
|
return {
|
|
5687
|
-
method
|
|
5688
|
-
file:
|
|
5689
|
-
line: parseInt(
|
|
5690
|
-
column: parseInt(
|
|
5702
|
+
method,
|
|
5703
|
+
file: slash(file),
|
|
5704
|
+
line: parseInt(lineNumber),
|
|
5705
|
+
column: parseInt(columnNumber)
|
|
5691
5706
|
};
|
|
5692
5707
|
}).filter(notNullish);
|
|
5693
5708
|
e.stacks = stackFrames;
|
|
@@ -7247,9 +7262,9 @@ function formatLine(line, outputTruncateLength) {
|
|
|
7247
7262
|
function unifiedDiff(actual, expected, options = {}) {
|
|
7248
7263
|
if (actual === expected)
|
|
7249
7264
|
return "";
|
|
7250
|
-
const { outputTruncateLength, showLegend = true } = options;
|
|
7265
|
+
const { outputTruncateLength, outputDiffLines, showLegend = true } = options;
|
|
7251
7266
|
const indent = " ";
|
|
7252
|
-
const diffLimit = 15;
|
|
7267
|
+
const diffLimit = outputDiffLines || 15;
|
|
7253
7268
|
const counts = {
|
|
7254
7269
|
"+": 0,
|
|
7255
7270
|
"-": 0
|
package/dist/{chunk-vite-node-externalize.d492e389.mjs → chunk-vite-node-externalize.6b27b039.mjs}
RENAMED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { j as join, k as basename, d as dirname, l as resolve, A as AggregateErrorPonyfill, p as picocolors, s as slash$2, m as isAbsolute, o as relative, q as isNode, u as getTests, v as getFullName, x as hasFailed, y as hasFailedSnapshot, z as getSuites, B as safeSetInterval, C as safeClearInterval, e as safeSetTimeout, t as toArray$1, D as normalize, n as noop$1, f as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, h as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.
|
|
1
|
+
import { j as join, k as basename, d as dirname, l as resolve, A as AggregateErrorPonyfill, p as picocolors, s as slash$2, m as isAbsolute, o as relative, q as isNode, u as getTests, v as getFullName, x as hasFailed, y as hasFailedSnapshot, z as getSuites, B as safeSetInterval, C as safeClearInterval, e as safeSetTimeout, t as toArray$1, D as normalize, n as noop$1, f as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, h as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.2684ee9f.mjs';
|
|
2
2
|
import { createServer, mergeConfig } from 'vite';
|
|
3
3
|
import path$a from 'path';
|
|
4
4
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
5
5
|
import process$1 from 'process';
|
|
6
6
|
import fs$8, { promises, existsSync, readFileSync } from 'fs';
|
|
7
|
-
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.
|
|
7
|
+
import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.da1921b9.mjs';
|
|
8
8
|
import readline from 'readline';
|
|
9
9
|
import require$$0, { cpus, hostname, constants as constants$5 } from 'os';
|
|
10
10
|
import require$$0$1 from 'util';
|
|
11
11
|
import require$$0$2 from 'stream';
|
|
12
12
|
import require$$2 from 'events';
|
|
13
13
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
14
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
14
|
+
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.b9738a10.mjs';
|
|
15
15
|
import createDebug from 'debug';
|
|
16
|
-
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.
|
|
16
|
+
import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.45dc5e3d.mjs';
|
|
17
17
|
import { MessageChannel } from 'worker_threads';
|
|
18
18
|
import { Tinypool } from 'tinypool';
|
|
19
19
|
import { performance } from 'perf_hooks';
|
|
20
|
-
import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.
|
|
21
|
-
import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.
|
|
20
|
+
import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.790e5c11.mjs';
|
|
21
|
+
import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.e5dc6622.mjs';
|
|
22
22
|
import { resolveModule } from 'local-pkg';
|
|
23
23
|
import { Buffer } from 'buffer';
|
|
24
24
|
import childProcess from 'child_process';
|
|
25
25
|
import MagicString from './chunk-magic-string.efe26975.mjs';
|
|
26
26
|
import { p as prompts } from './vendor-index.98e769c1.mjs';
|
|
27
27
|
|
|
28
|
-
var version = "0.14.
|
|
28
|
+
var version = "0.14.2";
|
|
29
29
|
|
|
30
30
|
/*
|
|
31
31
|
How it works:
|
|
@@ -9039,8 +9039,11 @@ async function printError(error, ctx, options) {
|
|
|
9039
9039
|
printErrorMessage(e, ctx.console);
|
|
9040
9040
|
printStack(ctx, stacks, nearest, errorProperties, (s, pos) => {
|
|
9041
9041
|
if (showCodeFrame && s === nearest && nearest) {
|
|
9042
|
-
const
|
|
9043
|
-
|
|
9042
|
+
const file = fileFromParsedStack(nearest);
|
|
9043
|
+
if (existsSync(file)) {
|
|
9044
|
+
const sourceCode = readFileSync(file, "utf-8");
|
|
9045
|
+
ctx.log(picocolors.exports.yellow(generateCodeFrame(sourceCode, 4, pos)));
|
|
9046
|
+
}
|
|
9044
9047
|
}
|
|
9045
9048
|
});
|
|
9046
9049
|
if (e.cause) {
|
|
@@ -9048,8 +9051,12 @@ async function printError(error, ctx, options) {
|
|
|
9048
9051
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
9049
9052
|
}
|
|
9050
9053
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
9051
|
-
if (e.showDiff)
|
|
9052
|
-
displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console,
|
|
9054
|
+
if (e.showDiff) {
|
|
9055
|
+
displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console, {
|
|
9056
|
+
outputTruncateLength: ctx.config.outputTruncateLength,
|
|
9057
|
+
outputDiffLines: ctx.config.outputDiffLines
|
|
9058
|
+
});
|
|
9059
|
+
}
|
|
9053
9060
|
}
|
|
9054
9061
|
function printErrorType(type, ctx) {
|
|
9055
9062
|
ctx.error(`
|
|
@@ -9108,8 +9115,8 @@ As a temporary workaround you can try to inline the package by updating your con
|
|
|
9108
9115
|
}
|
|
9109
9116
|
`)));
|
|
9110
9117
|
}
|
|
9111
|
-
function displayDiff(actual, expected, console,
|
|
9112
|
-
console.error(picocolors.exports.gray(unifiedDiff(actual, expected,
|
|
9118
|
+
function displayDiff(actual, expected, console, options) {
|
|
9119
|
+
console.error(picocolors.exports.gray(unifiedDiff(actual, expected, options)) + "\n");
|
|
9113
9120
|
}
|
|
9114
9121
|
function printErrorMessage(error, console) {
|
|
9115
9122
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
@@ -11001,7 +11008,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
11001
11008
|
await ctx.setServer(options, server);
|
|
11002
11009
|
haveStarted = true;
|
|
11003
11010
|
if (options.api && options.watch)
|
|
11004
|
-
(await import('./chunk-api-setup.
|
|
11011
|
+
(await import('./chunk-api-setup.aa092488.mjs')).setup(ctx);
|
|
11005
11012
|
if (!options.watch)
|
|
11006
11013
|
await server.watcher.close();
|
|
11007
11014
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { builtinModules, createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { m as isAbsolute$2, l as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.
|
|
4
|
+
import { m as isAbsolute$2, l as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.2684ee9f.mjs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { p as picocolors } from './chunk-utils-global.
|
|
3
|
-
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.
|
|
2
|
+
import { p as picocolors } from './chunk-utils-global.2684ee9f.mjs';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.6b27b039.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
@@ -8,23 +8,23 @@ import 'vite';
|
|
|
8
8
|
import 'url';
|
|
9
9
|
import 'process';
|
|
10
10
|
import 'fs';
|
|
11
|
-
import './chunk-constants.
|
|
11
|
+
import './chunk-constants.da1921b9.mjs';
|
|
12
12
|
import 'readline';
|
|
13
13
|
import 'os';
|
|
14
14
|
import 'util';
|
|
15
15
|
import 'stream';
|
|
16
16
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
17
|
-
import './chunk-vite-node-utils.
|
|
17
|
+
import './chunk-vite-node-utils.b9738a10.mjs';
|
|
18
18
|
import 'module';
|
|
19
19
|
import 'vm';
|
|
20
20
|
import 'assert';
|
|
21
21
|
import 'debug';
|
|
22
|
-
import './chunk-defaults.
|
|
22
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
23
23
|
import 'worker_threads';
|
|
24
24
|
import 'tinypool';
|
|
25
25
|
import 'perf_hooks';
|
|
26
|
-
import './chunk-utils-source-map.
|
|
27
|
-
import './vendor-index.
|
|
26
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
27
|
+
import './vendor-index.e5dc6622.mjs';
|
|
28
28
|
import 'child_process';
|
|
29
29
|
import 'buffer';
|
|
30
30
|
import './chunk-magic-string.efe26975.mjs';
|
|
@@ -644,7 +644,7 @@ class CAC extends EventEmitter {
|
|
|
644
644
|
const cac = (name) => new CAC(name);
|
|
645
645
|
|
|
646
646
|
const cli = cac("vitest");
|
|
647
|
-
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
|
|
647
|
+
cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length (default: 80)").option("--outputDiffLines <lines>", "number of diff output lines (default: 15)").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
|
|
648
648
|
cli.command("run [...filters]").action(run);
|
|
649
649
|
cli.command("related [...filters]").action(runRelated);
|
|
650
650
|
cli.command("watch [...filters]").action(start);
|
package/dist/entry.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { r as run } from './vendor-entry.
|
|
1
|
+
export { r as run } from './vendor-entry.ba490394.mjs';
|
|
2
2
|
import 'fs';
|
|
3
|
-
import './chunk-utils-global.
|
|
3
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-runtime-chain.
|
|
7
|
+
import './chunk-runtime-chain.52571387.mjs';
|
|
8
8
|
import 'chai';
|
|
9
9
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
10
|
-
import './chunk-runtime-rpc.
|
|
11
|
-
import './chunk-utils-source-map.
|
|
10
|
+
import './chunk-runtime-rpc.bcd3613c.mjs';
|
|
11
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
12
12
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
13
13
|
import 'tinyspy';
|
|
14
14
|
import 'util';
|
|
15
|
-
import './chunk-defaults.
|
|
15
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
16
16
|
import 'module';
|
|
17
17
|
import 'url';
|
package/dist/index.d.ts
CHANGED
|
@@ -979,6 +979,10 @@ interface InlineConfig {
|
|
|
979
979
|
* diff output length
|
|
980
980
|
*/
|
|
981
981
|
outputTruncateLength?: number;
|
|
982
|
+
/**
|
|
983
|
+
* number of diff output lines
|
|
984
|
+
*/
|
|
985
|
+
outputDiffLines?: number;
|
|
982
986
|
/**
|
|
983
987
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
984
988
|
* Also definable individually per reporter by using an object instead.
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.
|
|
1
|
+
export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.52571387.mjs';
|
|
2
2
|
export { assert, default as chai, should } from 'chai';
|
|
3
3
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
4
|
-
import './chunk-runtime-rpc.
|
|
5
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-runtime-rpc.bcd3613c.mjs';
|
|
5
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import 'path';
|
|
9
9
|
import 'fs';
|
|
10
|
-
import './chunk-utils-source-map.
|
|
10
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
11
11
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
12
12
|
import 'tinyspy';
|
|
13
13
|
import 'util';
|
package/dist/node.d.ts
CHANGED
|
@@ -798,6 +798,10 @@ interface InlineConfig {
|
|
|
798
798
|
* diff output length
|
|
799
799
|
*/
|
|
800
800
|
outputTruncateLength?: number;
|
|
801
|
+
/**
|
|
802
|
+
* number of diff output lines
|
|
803
|
+
*/
|
|
804
|
+
outputDiffLines?: number;
|
|
801
805
|
/**
|
|
802
806
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
803
807
|
* Also definable individually per reporter by using an object instead.
|
package/dist/node.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
3
|
-
import './chunk-utils-global.
|
|
1
|
+
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.6b27b039.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.292c0e16.mjs';
|
|
3
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
@@ -8,24 +8,24 @@ import 'vite';
|
|
|
8
8
|
import 'url';
|
|
9
9
|
import 'process';
|
|
10
10
|
import 'fs';
|
|
11
|
-
import './chunk-constants.
|
|
11
|
+
import './chunk-constants.da1921b9.mjs';
|
|
12
12
|
import 'readline';
|
|
13
13
|
import 'os';
|
|
14
14
|
import 'util';
|
|
15
15
|
import 'stream';
|
|
16
16
|
import 'events';
|
|
17
17
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
18
|
-
import './chunk-vite-node-utils.
|
|
18
|
+
import './chunk-vite-node-utils.b9738a10.mjs';
|
|
19
19
|
import 'module';
|
|
20
20
|
import 'vm';
|
|
21
21
|
import 'assert';
|
|
22
22
|
import 'debug';
|
|
23
|
-
import './chunk-defaults.
|
|
23
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
24
24
|
import 'worker_threads';
|
|
25
25
|
import 'tinypool';
|
|
26
26
|
import 'perf_hooks';
|
|
27
|
-
import './chunk-utils-source-map.
|
|
28
|
-
import './vendor-index.
|
|
27
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
28
|
+
import './vendor-index.e5dc6622.mjs';
|
|
29
29
|
import 'child_process';
|
|
30
30
|
import 'buffer';
|
|
31
31
|
import './chunk-magic-string.efe26975.mjs';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { q as isNode, a as getWorkerState, f as safeClearTimeout, e as safeSetTimeout, t as toArray, N as
|
|
2
|
+
import { q as isNode, a as getWorkerState, f as safeClearTimeout, e as safeSetTimeout, t as toArray, N as deepClone, L as getType, o as relative, O as partitionSuiteChildren, P as hasTests, x as hasFailed, v as getFullName, r as resetModules } from './chunk-utils-global.2684ee9f.mjs';
|
|
3
3
|
import { importModule } from 'local-pkg';
|
|
4
|
-
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.
|
|
4
|
+
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.52571387.mjs';
|
|
5
5
|
import chai, { assert, should, util } from 'chai';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
7
|
-
import { t as takeCoverage } from './chunk-defaults.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.bcd3613c.mjs';
|
|
7
|
+
import { t as takeCoverage } from './chunk-defaults.45dc5e3d.mjs';
|
|
8
8
|
import { format } from 'util';
|
|
9
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
9
|
+
import { s as stringify } from './chunk-utils-source-map.790e5c11.mjs';
|
|
10
10
|
|
|
11
11
|
var index = /*#__PURE__*/Object.freeze({
|
|
12
12
|
__proto__: null,
|
|
@@ -201,7 +201,9 @@ const LIVING_KEYS = [
|
|
|
201
201
|
"Headers",
|
|
202
202
|
"AbortController",
|
|
203
203
|
"AbortSignal",
|
|
204
|
-
"Image"
|
|
204
|
+
"Image",
|
|
205
|
+
"Audio",
|
|
206
|
+
"Option"
|
|
205
207
|
];
|
|
206
208
|
const OTHER_KEYS = [
|
|
207
209
|
"addEventListener",
|
|
@@ -273,7 +275,7 @@ const skipKeys = [
|
|
|
273
275
|
];
|
|
274
276
|
function getWindowKeys(global, win) {
|
|
275
277
|
const keys = new Set(KEYS.concat(Object.getOwnPropertyNames(win)).filter((k) => {
|
|
276
|
-
if (
|
|
278
|
+
if (skipKeys.includes(k))
|
|
277
279
|
return false;
|
|
278
280
|
if (k in global)
|
|
279
281
|
return allowRewrite.includes(k);
|
|
@@ -435,7 +437,7 @@ async function setupGlobalEnv(config) {
|
|
|
435
437
|
if (isNode)
|
|
436
438
|
await setupConsoleLogSpy();
|
|
437
439
|
if (config.globals)
|
|
438
|
-
(await import('./chunk-integrations-globals.
|
|
440
|
+
(await import('./chunk-integrations-globals.edcc399b.mjs')).registerApiGlobally();
|
|
439
441
|
}
|
|
440
442
|
function setupDefines(defines) {
|
|
441
443
|
for (const key in defines)
|
|
@@ -580,24 +582,24 @@ function serializeError(val, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
580
582
|
if (seen.has(val))
|
|
581
583
|
return seen.get(val);
|
|
582
584
|
if (Array.isArray(val)) {
|
|
583
|
-
const
|
|
584
|
-
seen.set(val,
|
|
585
|
+
const clone = new Array(val.length);
|
|
586
|
+
seen.set(val, clone);
|
|
585
587
|
val.forEach((e, i) => {
|
|
586
|
-
|
|
588
|
+
clone[i] = serializeError(e, seen);
|
|
587
589
|
});
|
|
588
|
-
return
|
|
590
|
+
return clone;
|
|
589
591
|
} else {
|
|
590
|
-
const
|
|
591
|
-
seen.set(val,
|
|
592
|
+
const clone = /* @__PURE__ */ Object.create(null);
|
|
593
|
+
seen.set(val, clone);
|
|
592
594
|
let obj = val;
|
|
593
595
|
while (obj && obj !== OBJECT_PROTO) {
|
|
594
596
|
Object.getOwnPropertyNames(obj).forEach((key) => {
|
|
595
|
-
if (!(key in
|
|
596
|
-
|
|
597
|
+
if (!(key in clone))
|
|
598
|
+
clone[key] = serializeError(obj[key], seen);
|
|
597
599
|
});
|
|
598
600
|
obj = Object.getPrototypeOf(obj);
|
|
599
601
|
}
|
|
600
|
-
return
|
|
602
|
+
return clone;
|
|
601
603
|
}
|
|
602
604
|
}
|
|
603
605
|
function normalizeErrorMessage(message) {
|
|
@@ -610,8 +612,8 @@ function processError(err) {
|
|
|
610
612
|
err.stackStr = String(err.stack);
|
|
611
613
|
if (err.name)
|
|
612
614
|
err.nameStr = String(err.name);
|
|
613
|
-
const clonedActual =
|
|
614
|
-
const clonedExpected =
|
|
615
|
+
const clonedActual = deepClone(err.actual);
|
|
616
|
+
const clonedExpected = deepClone(err.expected);
|
|
615
617
|
const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
|
|
616
618
|
err.actual = replacedActual;
|
|
617
619
|
err.expected = replacedExpected;
|
|
@@ -642,9 +644,13 @@ function isReplaceable(obj1, obj2) {
|
|
|
642
644
|
const obj2Type = getType(obj2);
|
|
643
645
|
return obj1Type === obj2Type && obj1Type === "Object";
|
|
644
646
|
}
|
|
645
|
-
function replaceAsymmetricMatcher(actual, expected) {
|
|
647
|
+
function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakMap(), expectedReplaced = /* @__PURE__ */ new WeakMap()) {
|
|
646
648
|
if (!isReplaceable(actual, expected))
|
|
647
649
|
return { replacedActual: actual, replacedExpected: expected };
|
|
650
|
+
if (actualReplaced.has(actual) || expectedReplaced.has(expected))
|
|
651
|
+
return { replacedActual: actual, replacedExpected: expected };
|
|
652
|
+
actualReplaced.set(actual, true);
|
|
653
|
+
expectedReplaced.set(expected, true);
|
|
648
654
|
util.getOwnEnumerableProperties(expected).forEach((key) => {
|
|
649
655
|
const expectedValue = expected[key];
|
|
650
656
|
const actualValue = actual[key];
|
|
@@ -655,7 +661,7 @@ function replaceAsymmetricMatcher(actual, expected) {
|
|
|
655
661
|
if (actualValue.asymmetricMatch(expectedValue))
|
|
656
662
|
expected[key] = actualValue;
|
|
657
663
|
} else if (isReplaceable(actualValue, expectedValue)) {
|
|
658
|
-
const replaced = replaceAsymmetricMatcher(actualValue, expectedValue);
|
|
664
|
+
const replaced = replaceAsymmetricMatcher(actualValue, expectedValue, actualReplaced, expectedReplaced);
|
|
659
665
|
actual[key] = replaced.replacedActual;
|
|
660
666
|
expected[key] = replaced.replacedExpected;
|
|
661
667
|
}
|
|
File without changes
|
package/dist/worker.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as resolve, a as getWorkerState } from './chunk-utils-global.
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.
|
|
3
|
-
import { d as distDir } from './chunk-constants.
|
|
4
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
1
|
+
import { l as resolve, a as getWorkerState } from './chunk-utils-global.2684ee9f.mjs';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.b9738a10.mjs';
|
|
3
|
+
import { d as distDir } from './chunk-constants.da1921b9.mjs';
|
|
4
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.292c0e16.mjs';
|
|
5
|
+
import { r as rpc } from './chunk-runtime-rpc.bcd3613c.mjs';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import 'path';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@types/node": "^17.0.35",
|
|
97
97
|
"@types/prompts": "^2.4.0",
|
|
98
98
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
99
|
-
"@vitest/ui": "0.14.
|
|
99
|
+
"@vitest/ui": "0.14.2",
|
|
100
100
|
"birpc": "^0.2.3",
|
|
101
101
|
"c8": "^7.11.3",
|
|
102
102
|
"cac": "^6.7.12",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"source-map-js": "^1.0.2",
|
|
124
124
|
"strip-ansi": "^7.0.1",
|
|
125
125
|
"typescript": "^4.7.2",
|
|
126
|
-
"vite-node": "0.14.
|
|
126
|
+
"vite-node": "0.14.2",
|
|
127
127
|
"ws": "^8.7.0"
|
|
128
128
|
},
|
|
129
129
|
"scripts": {
|