vitest 0.13.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/config.d.ts +1 -1
- package/dist/{chunk-api-setup.8d604f90.js → chunk-api-setup.aa092488.mjs} +4 -4
- package/dist/{chunk-constants.b0ea3b74.js → chunk-constants.da1921b9.mjs} +1 -1
- package/dist/{chunk-defaults.e5ec89dd.js → chunk-defaults.45dc5e3d.mjs} +3 -2
- package/dist/{chunk-install-pkg.e11db438.js → chunk-install-pkg.3fa50769.mjs} +2 -2
- package/dist/chunk-integrations-globals.edcc399b.mjs +26 -0
- package/dist/{chunk-integrations-spy.bee66426.js → chunk-integrations-spy.674b628e.mjs} +0 -0
- package/dist/{chunk-magic-string.41232190.js → chunk-magic-string.efe26975.mjs} +0 -0
- package/dist/{chunk-runtime-chain.46442ffe.js → chunk-runtime-chain.52571387.mjs} +43 -10
- package/dist/{chunk-runtime-mocker.e9fdf718.js → chunk-runtime-mocker.292c0e16.mjs} +4 -4
- package/dist/{chunk-runtime-rpc.50765c8b.js → chunk-runtime-rpc.bcd3613c.mjs} +1 -1
- package/dist/{chunk-utils-global.550519fc.js → chunk-utils-global.2684ee9f.mjs} +16 -9
- package/dist/{chunk-utils-source-map.19e9554e.js → chunk-utils-source-map.790e5c11.mjs} +35 -14
- package/dist/{chunk-vite-node-externalize.61cc47ef.js → chunk-vite-node-externalize.6b27b039.mjs} +66 -29
- package/dist/{chunk-vite-node-utils.52235551.js → chunk-vite-node-utils.b9738a10.mjs} +9 -2
- package/dist/{cli.js → cli.mjs} +11 -11
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/{config.js → config.mjs} +2 -1
- package/dist/entry.mjs +17 -0
- package/dist/index.d.ts +19 -7
- package/dist/{index.js → index.mjs} +6 -6
- package/dist/node.d.ts +17 -6
- package/dist/node.mjs +32 -0
- package/dist/{spy.js → spy.mjs} +1 -1
- package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.4da45ef5.mjs} +0 -0
- package/dist/{vendor-entry.225630f2.js → vendor-entry.ba490394.mjs} +27 -21
- package/dist/{vendor-index.405e58ef.js → vendor-index.98e769c1.mjs} +0 -0
- package/dist/{vendor-index.22581bd4.js → vendor-index.e5dc6622.mjs} +1 -1
- package/dist/{worker.js → worker.mjs} +6 -6
- package/node.d.ts +1 -1
- package/package.json +8 -9
- package/vitest.mjs +1 -1
- package/dist/chunk-integrations-globals.1cc5e231.js +0 -26
- package/dist/entry.js +0 -17
- package/dist/node.js +0 -32
package/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/config'
|
|
1
|
+
export * from './dist/config.js'
|
|
@@ -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}/**"];
|
|
@@ -55,7 +55,8 @@ const config = {
|
|
|
55
55
|
testTimeout: 5e3,
|
|
56
56
|
hookTimeout: 1e4,
|
|
57
57
|
isolate: true,
|
|
58
|
-
|
|
58
|
+
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
59
|
+
forceRerunTriggers: [],
|
|
59
60
|
update: false,
|
|
60
61
|
reporters: [],
|
|
61
62
|
silent: false,
|
|
@@ -2,9 +2,9 @@ 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
|
-
import './vendor-_commonjsHelpers.
|
|
7
|
+
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
8
8
|
import 'assert';
|
|
9
9
|
import 'events';
|
|
10
10
|
import 'buffer';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { g as globalApis } from './chunk-constants.da1921b9.mjs';
|
|
2
|
+
import { i as index } from './vendor-entry.ba490394.mjs';
|
|
3
|
+
import 'url';
|
|
4
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
5
|
+
import 'tty';
|
|
6
|
+
import 'local-pkg';
|
|
7
|
+
import 'path';
|
|
8
|
+
import 'fs';
|
|
9
|
+
import './chunk-runtime-chain.52571387.mjs';
|
|
10
|
+
import 'chai';
|
|
11
|
+
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
+
import './chunk-runtime-rpc.bcd3613c.mjs';
|
|
13
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
14
|
+
import './chunk-integrations-spy.674b628e.mjs';
|
|
15
|
+
import 'tinyspy';
|
|
16
|
+
import 'util';
|
|
17
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
18
|
+
import 'module';
|
|
19
|
+
|
|
20
|
+
function registerApiGlobally() {
|
|
21
|
+
globalApis.forEach((api) => {
|
|
22
|
+
globalThis[api] = index[api];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { registerApiGlobally };
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
|
|
2
|
-
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.
|
|
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.
|
|
2
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
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.
|
|
7
|
-
import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.
|
|
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
|
+
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
|
|
|
10
10
|
var __defProp$5 = Object.defineProperty;
|
|
@@ -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() {
|
|
@@ -586,7 +602,7 @@ function deepMergeSnapshot(target, source) {
|
|
|
586
602
|
}
|
|
587
603
|
|
|
588
604
|
async function saveInlineSnapshots(snapshots) {
|
|
589
|
-
const MagicString = (await import('./chunk-magic-string.
|
|
605
|
+
const MagicString = (await import('./chunk-magic-string.efe26975.mjs')).default;
|
|
590
606
|
const files = new Set(snapshots.map((i) => i.file));
|
|
591
607
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
592
608
|
const map = await rpc().getSourceMap(file);
|
|
@@ -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,
|
|
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;
|
|
@@ -171,7 +171,7 @@ const _VitestMocker = class {
|
|
|
171
171
|
async ensureSpy() {
|
|
172
172
|
if (_VitestMocker.spyModule)
|
|
173
173
|
return;
|
|
174
|
-
_VitestMocker.spyModule = await this.request(`/@fs/${slash(resolve(distDir, "spy.
|
|
174
|
+
_VitestMocker.spyModule = await this.request(`/@fs/${slash(resolve(distDir, "spy.mjs"))}`);
|
|
175
175
|
}
|
|
176
176
|
async requestWithMock(dep) {
|
|
177
177
|
var _a;
|
|
@@ -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;
|
|
@@ -452,14 +459,14 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
452
459
|
`));
|
|
453
460
|
if (!promptInstall)
|
|
454
461
|
return false;
|
|
455
|
-
const prompts = await import('./vendor-index.
|
|
462
|
+
const prompts = await import('./vendor-index.98e769c1.mjs').then(function (n) { return n.i; });
|
|
456
463
|
const { install } = await prompts.prompt({
|
|
457
464
|
type: "confirm",
|
|
458
465
|
name: "install",
|
|
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
|
|
@@ -7278,6 +7293,7 @@ function unifiedDiff(actual, expected, options = {}) {
|
|
|
7278
7293
|
const lines = msg.split("\n").slice(5).map(preprocess).filter(Boolean);
|
|
7279
7294
|
const isCompact = counts["+"] === 1 && counts["-"] === 1 && lines.length === 2;
|
|
7280
7295
|
let formatted = lines.map((line) => {
|
|
7296
|
+
line = line.replace(/\\"/g, '"');
|
|
7281
7297
|
if (line[0] === "-") {
|
|
7282
7298
|
line = formatLine(line.slice(1), outputTruncateLength);
|
|
7283
7299
|
if (isCompact)
|
|
@@ -7301,6 +7317,11 @@ function unifiedDiff(actual, expected, options = {}) {
|
|
|
7301
7317
|
`${picocolors.exports.red("+ Received")} ${formatted[1]}`
|
|
7302
7318
|
];
|
|
7303
7319
|
} else {
|
|
7320
|
+
if (formatted[0].includes('"'))
|
|
7321
|
+
formatted[0] = formatted[0].replace('"', "");
|
|
7322
|
+
const last = formatted.length - 1;
|
|
7323
|
+
if (formatted[last].endsWith('"'))
|
|
7324
|
+
formatted[last] = formatted[last].slice(0, formatted[last].length - 1);
|
|
7304
7325
|
formatted.unshift(picocolors.exports.green(`- Expected - ${counts["-"]}`), picocolors.exports.red(`+ Received + ${counts["+"]}`), "");
|
|
7305
7326
|
}
|
|
7306
7327
|
}
|
package/dist/{chunk-vite-node-externalize.61cc47ef.js → 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, 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
|
-
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.
|
|
14
|
-
import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.
|
|
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.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
|
-
import MagicString from './chunk-magic-string.
|
|
26
|
-
import { p as prompts } from './vendor-index.
|
|
25
|
+
import MagicString from './chunk-magic-string.efe26975.mjs';
|
|
26
|
+
import { p as prompts } from './vendor-index.98e769c1.mjs';
|
|
27
27
|
|
|
28
|
-
var version = "0.
|
|
28
|
+
var version = "0.14.2";
|
|
29
29
|
|
|
30
30
|
/*
|
|
31
31
|
How it works:
|
|
@@ -6930,8 +6930,10 @@ async function _shouldExternalize(id, options) {
|
|
|
6930
6930
|
return false;
|
|
6931
6931
|
}
|
|
6932
6932
|
function matchExternalizePattern(id, patterns) {
|
|
6933
|
-
if (
|
|
6933
|
+
if (patterns == null)
|
|
6934
6934
|
return false;
|
|
6935
|
+
if (patterns === true)
|
|
6936
|
+
return true;
|
|
6935
6937
|
for (const ex of patterns) {
|
|
6936
6938
|
if (typeof ex === "string") {
|
|
6937
6939
|
if (id.includes(`/node_modules/${ex}/`))
|
|
@@ -6980,6 +6982,17 @@ class ViteNodeServer {
|
|
|
6980
6982
|
this.fetchPromiseMap = /* @__PURE__ */ new Map();
|
|
6981
6983
|
this.transformPromiseMap = /* @__PURE__ */ new Map();
|
|
6982
6984
|
this.fetchCache = /* @__PURE__ */ new Map();
|
|
6985
|
+
var _a, _b;
|
|
6986
|
+
const ssrOptions = server.config.ssr;
|
|
6987
|
+
if (ssrOptions) {
|
|
6988
|
+
options.deps ?? (options.deps = {});
|
|
6989
|
+
if (ssrOptions.noExternal === true) {
|
|
6990
|
+
(_a = options.deps).inline ?? (_a.inline = true);
|
|
6991
|
+
} else if (options.deps.inline !== true) {
|
|
6992
|
+
(_b = options.deps).inline ?? (_b.inline = []);
|
|
6993
|
+
options.deps.inline.push(...toArray(ssrOptions.noExternal));
|
|
6994
|
+
}
|
|
6995
|
+
}
|
|
6983
6996
|
}
|
|
6984
6997
|
shouldExternalize(id) {
|
|
6985
6998
|
return shouldExternalize(id, this.options.deps);
|
|
@@ -7134,7 +7147,7 @@ var __spreadValues$5 = (a, b) => {
|
|
|
7134
7147
|
}
|
|
7135
7148
|
return a;
|
|
7136
7149
|
};
|
|
7137
|
-
const workerPath = pathToFileURL(resolve(distDir, "./worker.
|
|
7150
|
+
const workerPath = pathToFileURL(resolve(distDir, "./worker.mjs")).href;
|
|
7138
7151
|
function createPool(ctx) {
|
|
7139
7152
|
var _a;
|
|
7140
7153
|
const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
|
|
@@ -8964,8 +8977,15 @@ function resolveConfig(options, viteConfig) {
|
|
|
8964
8977
|
resolved.base = viteConfig.base;
|
|
8965
8978
|
resolved.coverage = resolveC8Options(options.coverage || {}, resolved.root);
|
|
8966
8979
|
resolved.deps = resolved.deps || {};
|
|
8967
|
-
(
|
|
8968
|
-
|
|
8980
|
+
if (resolved.deps.inline !== true) {
|
|
8981
|
+
const ssrOptions = viteConfig.ssr || {};
|
|
8982
|
+
if (ssrOptions.noExternal === true && resolved.deps.inline == null) {
|
|
8983
|
+
resolved.deps.inline = true;
|
|
8984
|
+
} else {
|
|
8985
|
+
(_b = resolved.deps).inline ?? (_b.inline = []);
|
|
8986
|
+
resolved.deps.inline.push(...extraInlineDeps);
|
|
8987
|
+
}
|
|
8988
|
+
}
|
|
8969
8989
|
resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
|
|
8970
8990
|
const CI = !!process.env.CI;
|
|
8971
8991
|
const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
|
|
@@ -8980,13 +9000,13 @@ function resolveConfig(options, viteConfig) {
|
|
|
8980
9000
|
resolved.maxThreads = parseInt(process.env.VITEST_MAX_THREADS);
|
|
8981
9001
|
if (process.env.VITEST_MIN_THREADS)
|
|
8982
9002
|
resolved.minThreads = parseInt(process.env.VITEST_MIN_THREADS);
|
|
8983
|
-
resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => normalize(resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)));
|
|
9003
|
+
resolved.setupFiles = toArray$1(resolved.setupFiles || []).map((file) => normalize(resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)));
|
|
8984
9004
|
resolved.api = resolveApiConfig(options);
|
|
8985
9005
|
if (options.related)
|
|
8986
|
-
resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
|
|
9006
|
+
resolved.related = toArray$1(options.related).map((file) => resolve(resolved.root, file));
|
|
8987
9007
|
resolved.reporters = Array.from(/* @__PURE__ */ new Set([
|
|
8988
|
-
...toArray(resolved.reporters),
|
|
8989
|
-
...toArray(resolved.reporter)
|
|
9008
|
+
...toArray$1(resolved.reporters),
|
|
9009
|
+
...toArray$1(resolved.reporter)
|
|
8990
9010
|
])).filter(Boolean);
|
|
8991
9011
|
if (!resolved.reporters.length)
|
|
8992
9012
|
resolved.reporters.push("default");
|
|
@@ -9019,8 +9039,11 @@ async function printError(error, ctx, options) {
|
|
|
9019
9039
|
printErrorMessage(e, ctx.console);
|
|
9020
9040
|
printStack(ctx, stacks, nearest, errorProperties, (s, pos) => {
|
|
9021
9041
|
if (showCodeFrame && s === nearest && nearest) {
|
|
9022
|
-
const
|
|
9023
|
-
|
|
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
|
+
}
|
|
9024
9047
|
}
|
|
9025
9048
|
});
|
|
9026
9049
|
if (e.cause) {
|
|
@@ -9028,8 +9051,12 @@ async function printError(error, ctx, options) {
|
|
|
9028
9051
|
await printError(e.cause, ctx, { fullStack, showCodeFrame: false });
|
|
9029
9052
|
}
|
|
9030
9053
|
handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
|
|
9031
|
-
if (e.showDiff)
|
|
9032
|
-
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
|
+
}
|
|
9033
9060
|
}
|
|
9034
9061
|
function printErrorType(type, ctx) {
|
|
9035
9062
|
ctx.error(`
|
|
@@ -9088,8 +9115,8 @@ As a temporary workaround you can try to inline the package by updating your con
|
|
|
9088
9115
|
}
|
|
9089
9116
|
`)));
|
|
9090
9117
|
}
|
|
9091
|
-
function displayDiff(actual, expected, console,
|
|
9092
|
-
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");
|
|
9093
9120
|
}
|
|
9094
9121
|
function printErrorMessage(error, console) {
|
|
9095
9122
|
const errorName = error.name || error.nameStr || "Unknown Error";
|
|
@@ -10368,8 +10395,8 @@ class Vitest {
|
|
|
10368
10395
|
this.console.error(picocolors.exports.dim("filter: ") + picocolors.exports.yellow(filters.join(comma)));
|
|
10369
10396
|
if (this.config.include)
|
|
10370
10397
|
this.console.error(picocolors.exports.dim("include: ") + picocolors.exports.yellow(this.config.include.join(comma)));
|
|
10371
|
-
if (this.config.
|
|
10372
|
-
this.console.error(picocolors.exports.dim("
|
|
10398
|
+
if (this.config.watchExclude)
|
|
10399
|
+
this.console.error(picocolors.exports.dim("watch exclude: ") + picocolors.exports.yellow(this.config.watchExclude.join(comma)));
|
|
10373
10400
|
if (this.config.passWithNoTests)
|
|
10374
10401
|
this.log("No test files found, exiting with code 0\n");
|
|
10375
10402
|
else
|
|
@@ -10546,6 +10573,9 @@ class Vitest {
|
|
|
10546
10573
|
}
|
|
10547
10574
|
};
|
|
10548
10575
|
const watcher = this.server.watcher;
|
|
10576
|
+
if (this.config.forceRerunTriggers.length)
|
|
10577
|
+
watcher.add(this.config.forceRerunTriggers);
|
|
10578
|
+
watcher.unwatch(this.config.watchExclude);
|
|
10549
10579
|
watcher.on("change", onChange);
|
|
10550
10580
|
watcher.on("unlink", onUnlink);
|
|
10551
10581
|
watcher.on("add", onAdd);
|
|
@@ -10557,8 +10587,12 @@ class Vitest {
|
|
|
10557
10587
|
};
|
|
10558
10588
|
}
|
|
10559
10589
|
handleFileChanged(id) {
|
|
10560
|
-
if (this.changedTests.has(id) || this.invalidates.has(id)
|
|
10590
|
+
if (this.changedTests.has(id) || this.invalidates.has(id))
|
|
10561
10591
|
return false;
|
|
10592
|
+
if (micromatch_1.isMatch(id, this.config.forceRerunTriggers)) {
|
|
10593
|
+
this.state.getFilepaths().forEach((file) => this.changedTests.add(file));
|
|
10594
|
+
return true;
|
|
10595
|
+
}
|
|
10562
10596
|
const mod = this.server.moduleGraph.getModuleById(id);
|
|
10563
10597
|
if (!mod)
|
|
10564
10598
|
return false;
|
|
@@ -10688,7 +10722,7 @@ async function loadGlobalSetupFiles(ctx) {
|
|
|
10688
10722
|
var _a;
|
|
10689
10723
|
const server = ctx.server;
|
|
10690
10724
|
const runner = ctx.runner;
|
|
10691
|
-
const globalSetupFiles = toArray((_a = server.config.test) == null ? void 0 : _a.globalSetup);
|
|
10725
|
+
const globalSetupFiles = toArray$1((_a = server.config.test) == null ? void 0 : _a.globalSetup);
|
|
10692
10726
|
return Promise.all(globalSetupFiles.map((file) => loadGlobalSetupFile(file, runner)));
|
|
10693
10727
|
}
|
|
10694
10728
|
async function loadGlobalSetupFile(file, runner) {
|
|
@@ -10939,6 +10973,9 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10939
10973
|
mainFields: []
|
|
10940
10974
|
},
|
|
10941
10975
|
server: __spreadProps(__spreadValues({}, preOptions.api), {
|
|
10976
|
+
watch: {
|
|
10977
|
+
ignored: preOptions.watchExclude
|
|
10978
|
+
},
|
|
10942
10979
|
open,
|
|
10943
10980
|
hmr: false,
|
|
10944
10981
|
preTransformRequests: false
|
|
@@ -10971,7 +11008,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10971
11008
|
await ctx.setServer(options, server);
|
|
10972
11009
|
haveStarted = true;
|
|
10973
11010
|
if (options.api && options.watch)
|
|
10974
|
-
(await import('./chunk-api-setup.
|
|
11011
|
+
(await import('./chunk-api-setup.aa092488.mjs')).setup(ctx);
|
|
10975
11012
|
if (!options.watch)
|
|
10976
11013
|
await server.watcher.close();
|
|
10977
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';
|
|
@@ -8878,6 +8878,13 @@ async function withInlineSourcemap(result) {
|
|
|
8878
8878
|
`;
|
|
8879
8879
|
return result;
|
|
8880
8880
|
}
|
|
8881
|
+
function toArray(array) {
|
|
8882
|
+
if (array === null || array === void 0)
|
|
8883
|
+
array = [];
|
|
8884
|
+
if (Array.isArray(array))
|
|
8885
|
+
return array;
|
|
8886
|
+
return [array];
|
|
8887
|
+
}
|
|
8881
8888
|
|
|
8882
8889
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
8883
8890
|
const debugNative = createDebug("vite-node:client:native");
|
|
@@ -9170,4 +9177,4 @@ function nanoid(size = 21) {
|
|
|
9170
9177
|
return id;
|
|
9171
9178
|
}
|
|
9172
9179
|
|
|
9173
|
-
export { ModuleCacheMap as M, ViteNodeRunner as V, isValidNodeImport as a, createBirpc as c, isNodeBuiltin as i, normalizeRequestId as n, slash as s,
|
|
9180
|
+
export { ModuleCacheMap as M, ViteNodeRunner as V, isValidNodeImport as a, toFilePath as b, createBirpc as c, isNodeBuiltin as i, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
|
package/dist/{cli.js → cli.mjs}
RENAMED
|
@@ -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,27 +8,27 @@ 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
|
-
import './vendor-_commonjsHelpers.
|
|
17
|
-
import './chunk-vite-node-utils.
|
|
16
|
+
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
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
|
-
import './chunk-magic-string.
|
|
31
|
-
import './vendor-index.
|
|
30
|
+
import './chunk-magic-string.efe26975.mjs';
|
|
31
|
+
import './vendor-index.98e769c1.mjs';
|
|
32
32
|
|
|
33
33
|
function toArr(any) {
|
|
34
34
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -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/config.cjs
CHANGED
|
@@ -54,7 +54,8 @@ const config = {
|
|
|
54
54
|
testTimeout: 5e3,
|
|
55
55
|
hookTimeout: 1e4,
|
|
56
56
|
isolate: true,
|
|
57
|
-
|
|
57
|
+
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
58
|
+
forceRerunTriggers: [],
|
|
58
59
|
update: false,
|
|
59
60
|
reporters: [],
|
|
60
61
|
silent: false,
|
package/dist/config.d.ts
CHANGED
|
@@ -50,7 +50,8 @@ const config = {
|
|
|
50
50
|
testTimeout: 5e3,
|
|
51
51
|
hookTimeout: 1e4,
|
|
52
52
|
isolate: true,
|
|
53
|
-
|
|
53
|
+
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
54
|
+
forceRerunTriggers: [],
|
|
54
55
|
update: false,
|
|
55
56
|
reporters: [],
|
|
56
57
|
silent: false,
|
package/dist/entry.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { r as run } from './vendor-entry.ba490394.mjs';
|
|
2
|
+
import 'fs';
|
|
3
|
+
import './chunk-utils-global.2684ee9f.mjs';
|
|
4
|
+
import 'tty';
|
|
5
|
+
import 'local-pkg';
|
|
6
|
+
import 'path';
|
|
7
|
+
import './chunk-runtime-chain.52571387.mjs';
|
|
8
|
+
import 'chai';
|
|
9
|
+
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
10
|
+
import './chunk-runtime-rpc.bcd3613c.mjs';
|
|
11
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
12
|
+
import './chunk-integrations-spy.674b628e.mjs';
|
|
13
|
+
import 'tinyspy';
|
|
14
|
+
import 'util';
|
|
15
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
16
|
+
import 'module';
|
|
17
|
+
import 'url';
|
package/dist/index.d.ts
CHANGED
|
@@ -192,10 +192,9 @@ declare class ViteNodeRunner {
|
|
|
192
192
|
hasNestedDefault(target: any): any;
|
|
193
193
|
private debugLog;
|
|
194
194
|
}
|
|
195
|
-
|
|
196
195
|
interface DepsHandlingOptions {
|
|
197
196
|
external?: (string | RegExp)[];
|
|
198
|
-
inline?: (string | RegExp)[];
|
|
197
|
+
inline?: (string | RegExp)[] | true;
|
|
199
198
|
/**
|
|
200
199
|
* Try to guess the CJS version of a package when it's invalid ESM
|
|
201
200
|
* @default false
|
|
@@ -733,7 +732,7 @@ interface Test<ExtraContext = {}> extends TaskBase {
|
|
|
733
732
|
}
|
|
734
733
|
declare type Task = Test | Suite | File;
|
|
735
734
|
declare type DoneCallback = (error?: any) => void;
|
|
736
|
-
declare type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<void
|
|
735
|
+
declare type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
|
|
737
736
|
declare type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
|
|
738
737
|
1: [T[0]];
|
|
739
738
|
2: [T[0], T[1]];
|
|
@@ -910,8 +909,10 @@ interface InlineConfig {
|
|
|
910
909
|
* Vite will process inlined modules.
|
|
911
910
|
*
|
|
912
911
|
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
912
|
+
*
|
|
913
|
+
* If `true`, every dependency will be inlined
|
|
913
914
|
*/
|
|
914
|
-
inline?: (string | RegExp)[];
|
|
915
|
+
inline?: (string | RegExp)[] | true;
|
|
915
916
|
/**
|
|
916
917
|
* Interpret CJS module's default as named exports
|
|
917
918
|
*
|
|
@@ -978,6 +979,10 @@ interface InlineConfig {
|
|
|
978
979
|
* diff output length
|
|
979
980
|
*/
|
|
980
981
|
outputTruncateLength?: number;
|
|
982
|
+
/**
|
|
983
|
+
* number of diff output lines
|
|
984
|
+
*/
|
|
985
|
+
outputDiffLines?: number;
|
|
981
986
|
/**
|
|
982
987
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
983
988
|
* Also definable individually per reporter by using an object instead.
|
|
@@ -1028,11 +1033,17 @@ interface InlineConfig {
|
|
|
1028
1033
|
*/
|
|
1029
1034
|
globalSetup?: string | string[];
|
|
1030
1035
|
/**
|
|
1031
|
-
*
|
|
1036
|
+
* Glob pattern of file paths to be ignore from triggering watch rerun
|
|
1037
|
+
*/
|
|
1038
|
+
watchExclude?: string[];
|
|
1039
|
+
/**
|
|
1040
|
+
* Glob patter of file paths that will trigger the whole suite rerun
|
|
1041
|
+
*
|
|
1042
|
+
* Useful if you are testing calling CLI commands
|
|
1032
1043
|
*
|
|
1033
|
-
* @default [
|
|
1044
|
+
* @default []
|
|
1034
1045
|
*/
|
|
1035
|
-
|
|
1046
|
+
forceRerunTriggers?: string[];
|
|
1036
1047
|
/**
|
|
1037
1048
|
* Isolate environment for each test file
|
|
1038
1049
|
*
|
|
@@ -1521,6 +1532,7 @@ declare type Classes<T> = {
|
|
|
1521
1532
|
[K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
|
|
1522
1533
|
}[keyof T] & (string | symbol);
|
|
1523
1534
|
interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
|
|
1535
|
+
(...args: TArgs): TReturns;
|
|
1524
1536
|
getMockName(): string;
|
|
1525
1537
|
mockName(n: string): this;
|
|
1526
1538
|
mock: SpyContext<TArgs, TReturns>;
|
|
@@ -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
|
-
import './vendor-_commonjsHelpers.
|
|
4
|
-
import './chunk-runtime-rpc.
|
|
5
|
-
import './chunk-utils-global.
|
|
3
|
+
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
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.
|
|
11
|
-
import './chunk-integrations-spy.
|
|
10
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
11
|
+
import './chunk-integrations-spy.674b628e.mjs';
|
|
12
12
|
import 'tinyspy';
|
|
13
13
|
import 'util';
|
package/dist/node.d.ts
CHANGED
|
@@ -36,10 +36,9 @@ declare class ViteNodeRunner {
|
|
|
36
36
|
hasNestedDefault(target: any): any;
|
|
37
37
|
private debugLog;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
39
|
interface DepsHandlingOptions {
|
|
41
40
|
external?: (string | RegExp)[];
|
|
42
|
-
inline?: (string | RegExp)[];
|
|
41
|
+
inline?: (string | RegExp)[] | true;
|
|
43
42
|
/**
|
|
44
43
|
* Try to guess the CJS version of a package when it's invalid ESM
|
|
45
44
|
* @default false
|
|
@@ -729,8 +728,10 @@ interface InlineConfig {
|
|
|
729
728
|
* Vite will process inlined modules.
|
|
730
729
|
*
|
|
731
730
|
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
|
|
731
|
+
*
|
|
732
|
+
* If `true`, every dependency will be inlined
|
|
732
733
|
*/
|
|
733
|
-
inline?: (string | RegExp)[];
|
|
734
|
+
inline?: (string | RegExp)[] | true;
|
|
734
735
|
/**
|
|
735
736
|
* Interpret CJS module's default as named exports
|
|
736
737
|
*
|
|
@@ -797,6 +798,10 @@ interface InlineConfig {
|
|
|
797
798
|
* diff output length
|
|
798
799
|
*/
|
|
799
800
|
outputTruncateLength?: number;
|
|
801
|
+
/**
|
|
802
|
+
* number of diff output lines
|
|
803
|
+
*/
|
|
804
|
+
outputDiffLines?: number;
|
|
800
805
|
/**
|
|
801
806
|
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
|
|
802
807
|
* Also definable individually per reporter by using an object instead.
|
|
@@ -847,11 +852,17 @@ interface InlineConfig {
|
|
|
847
852
|
*/
|
|
848
853
|
globalSetup?: string | string[];
|
|
849
854
|
/**
|
|
850
|
-
*
|
|
855
|
+
* Glob pattern of file paths to be ignore from triggering watch rerun
|
|
856
|
+
*/
|
|
857
|
+
watchExclude?: string[];
|
|
858
|
+
/**
|
|
859
|
+
* Glob patter of file paths that will trigger the whole suite rerun
|
|
851
860
|
*
|
|
852
|
-
*
|
|
861
|
+
* Useful if you are testing calling CLI commands
|
|
862
|
+
*
|
|
863
|
+
* @default []
|
|
853
864
|
*/
|
|
854
|
-
|
|
865
|
+
forceRerunTriggers?: string[];
|
|
855
866
|
/**
|
|
856
867
|
* Isolate environment for each test file
|
|
857
868
|
*
|
package/dist/node.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import 'tty';
|
|
5
|
+
import 'local-pkg';
|
|
6
|
+
import 'path';
|
|
7
|
+
import 'vite';
|
|
8
|
+
import 'url';
|
|
9
|
+
import 'process';
|
|
10
|
+
import 'fs';
|
|
11
|
+
import './chunk-constants.da1921b9.mjs';
|
|
12
|
+
import 'readline';
|
|
13
|
+
import 'os';
|
|
14
|
+
import 'util';
|
|
15
|
+
import 'stream';
|
|
16
|
+
import 'events';
|
|
17
|
+
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
18
|
+
import './chunk-vite-node-utils.b9738a10.mjs';
|
|
19
|
+
import 'module';
|
|
20
|
+
import 'vm';
|
|
21
|
+
import 'assert';
|
|
22
|
+
import 'debug';
|
|
23
|
+
import './chunk-defaults.45dc5e3d.mjs';
|
|
24
|
+
import 'worker_threads';
|
|
25
|
+
import 'tinypool';
|
|
26
|
+
import 'perf_hooks';
|
|
27
|
+
import './chunk-utils-source-map.790e5c11.mjs';
|
|
28
|
+
import './vendor-index.e5dc6622.mjs';
|
|
29
|
+
import 'child_process';
|
|
30
|
+
import 'buffer';
|
|
31
|
+
import './chunk-magic-string.efe26975.mjs';
|
|
32
|
+
import './vendor-index.98e769c1.mjs';
|
package/dist/{spy.js → spy.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { f as fn, i as isMockFunction, a as spies, s as spyOn } from './chunk-integrations-spy.
|
|
1
|
+
export { f as fn, i as isMockFunction, a as spies, s as spyOn } from './chunk-integrations-spy.674b628e.mjs';
|
|
2
2
|
import 'tinyspy';
|
|
File without changes
|
|
@@ -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
|
|
@@ -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';
|
|
@@ -35,7 +35,7 @@ async function startViteNode(ctx) {
|
|
|
35
35
|
const { config } = ctx;
|
|
36
36
|
const { run: run2 } = (await executeInViteNode({
|
|
37
37
|
files: [
|
|
38
|
-
resolve(distDir, "entry.
|
|
38
|
+
resolve(distDir, "entry.mjs")
|
|
39
39
|
],
|
|
40
40
|
fetchModule(id) {
|
|
41
41
|
return rpc().fetch(id);
|
package/node.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/node'
|
|
1
|
+
export * from './dist/node.js'
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.13.1",
|
|
3
|
+
"version": "0.14.2",
|
|
5
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
6
|
"license": "MIT",
|
|
@@ -23,7 +22,7 @@
|
|
|
23
22
|
"exports": {
|
|
24
23
|
".": {
|
|
25
24
|
"types": "./dist/index.d.ts",
|
|
26
|
-
"import": "./dist/index.
|
|
25
|
+
"import": "./dist/index.mjs"
|
|
27
26
|
},
|
|
28
27
|
"./*": "./*",
|
|
29
28
|
"./globals": {
|
|
@@ -34,16 +33,16 @@
|
|
|
34
33
|
},
|
|
35
34
|
"./node": {
|
|
36
35
|
"types": "./dist/node.d.ts",
|
|
37
|
-
"import": "./dist/node.
|
|
36
|
+
"import": "./dist/node.mjs"
|
|
38
37
|
},
|
|
39
38
|
"./config": {
|
|
40
39
|
"types": "./config.d.ts",
|
|
41
40
|
"require": "./dist/config.cjs",
|
|
42
|
-
"import": "./dist/config.
|
|
41
|
+
"import": "./dist/config.mjs"
|
|
43
42
|
}
|
|
44
43
|
},
|
|
45
|
-
"main": "./dist/index.
|
|
46
|
-
"module": "./dist/index.
|
|
44
|
+
"main": "./dist/index.mjs",
|
|
45
|
+
"module": "./dist/index.mjs",
|
|
47
46
|
"types": "./dist/index.d.ts",
|
|
48
47
|
"bin": {
|
|
49
48
|
"vitest": "./vitest.mjs"
|
|
@@ -97,7 +96,7 @@
|
|
|
97
96
|
"@types/node": "^17.0.35",
|
|
98
97
|
"@types/prompts": "^2.4.0",
|
|
99
98
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
100
|
-
"@vitest/ui": "0.
|
|
99
|
+
"@vitest/ui": "0.14.2",
|
|
101
100
|
"birpc": "^0.2.3",
|
|
102
101
|
"c8": "^7.11.3",
|
|
103
102
|
"cac": "^6.7.12",
|
|
@@ -124,7 +123,7 @@
|
|
|
124
123
|
"source-map-js": "^1.0.2",
|
|
125
124
|
"strip-ansi": "^7.0.1",
|
|
126
125
|
"typescript": "^4.7.2",
|
|
127
|
-
"vite-node": "0.
|
|
126
|
+
"vite-node": "0.14.2",
|
|
128
127
|
"ws": "^8.7.0"
|
|
129
128
|
},
|
|
130
129
|
"scripts": {
|
package/vitest.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import './dist/cli.
|
|
2
|
+
import './dist/cli.mjs'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.b0ea3b74.js';
|
|
2
|
-
import { i as index } from './vendor-entry.225630f2.js';
|
|
3
|
-
import 'url';
|
|
4
|
-
import './chunk-utils-global.550519fc.js';
|
|
5
|
-
import 'tty';
|
|
6
|
-
import 'local-pkg';
|
|
7
|
-
import 'path';
|
|
8
|
-
import 'fs';
|
|
9
|
-
import './chunk-runtime-chain.46442ffe.js';
|
|
10
|
-
import 'chai';
|
|
11
|
-
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
-
import './chunk-runtime-rpc.50765c8b.js';
|
|
13
|
-
import './chunk-utils-source-map.19e9554e.js';
|
|
14
|
-
import './chunk-integrations-spy.bee66426.js';
|
|
15
|
-
import 'tinyspy';
|
|
16
|
-
import 'util';
|
|
17
|
-
import './chunk-defaults.e5ec89dd.js';
|
|
18
|
-
import 'module';
|
|
19
|
-
|
|
20
|
-
function registerApiGlobally() {
|
|
21
|
-
globalApis.forEach((api) => {
|
|
22
|
-
globalThis[api] = index[api];
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { registerApiGlobally };
|
package/dist/entry.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { r as run } from './vendor-entry.225630f2.js';
|
|
2
|
-
import 'fs';
|
|
3
|
-
import './chunk-utils-global.550519fc.js';
|
|
4
|
-
import 'tty';
|
|
5
|
-
import 'local-pkg';
|
|
6
|
-
import 'path';
|
|
7
|
-
import './chunk-runtime-chain.46442ffe.js';
|
|
8
|
-
import 'chai';
|
|
9
|
-
import './vendor-_commonjsHelpers.addc3445.js';
|
|
10
|
-
import './chunk-runtime-rpc.50765c8b.js';
|
|
11
|
-
import './chunk-utils-source-map.19e9554e.js';
|
|
12
|
-
import './chunk-integrations-spy.bee66426.js';
|
|
13
|
-
import 'tinyspy';
|
|
14
|
-
import 'util';
|
|
15
|
-
import './chunk-defaults.e5ec89dd.js';
|
|
16
|
-
import 'module';
|
|
17
|
-
import 'url';
|
package/dist/node.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.61cc47ef.js';
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.e9fdf718.js';
|
|
3
|
-
import './chunk-utils-global.550519fc.js';
|
|
4
|
-
import 'tty';
|
|
5
|
-
import 'local-pkg';
|
|
6
|
-
import 'path';
|
|
7
|
-
import 'vite';
|
|
8
|
-
import 'url';
|
|
9
|
-
import 'process';
|
|
10
|
-
import 'fs';
|
|
11
|
-
import './chunk-constants.b0ea3b74.js';
|
|
12
|
-
import 'readline';
|
|
13
|
-
import 'os';
|
|
14
|
-
import 'util';
|
|
15
|
-
import 'stream';
|
|
16
|
-
import 'events';
|
|
17
|
-
import './vendor-_commonjsHelpers.addc3445.js';
|
|
18
|
-
import './chunk-vite-node-utils.52235551.js';
|
|
19
|
-
import 'module';
|
|
20
|
-
import 'vm';
|
|
21
|
-
import 'assert';
|
|
22
|
-
import 'debug';
|
|
23
|
-
import './chunk-defaults.e5ec89dd.js';
|
|
24
|
-
import 'worker_threads';
|
|
25
|
-
import 'tinypool';
|
|
26
|
-
import 'perf_hooks';
|
|
27
|
-
import './chunk-utils-source-map.19e9554e.js';
|
|
28
|
-
import './vendor-index.22581bd4.js';
|
|
29
|
-
import 'child_process';
|
|
30
|
-
import 'buffer';
|
|
31
|
-
import './chunk-magic-string.41232190.js';
|
|
32
|
-
import './vendor-index.405e58ef.js';
|