vitest 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-api-setup.5282c6cb.mjs → chunk-api-setup.c728e251.mjs} +4 -4
- package/dist/{chunk-constants.511c6e9b.mjs → chunk-constants.27550afb.mjs} +1 -1
- package/dist/{chunk-env-node.dc514f41.mjs → chunk-env-node.aa51c4cc.mjs} +8 -3
- package/dist/{chunk-install-pkg.3fa50769.mjs → chunk-install-pkg.6f5930c3.mjs} +1 -1
- package/dist/{chunk-integrations-globals.6bb781c7.mjs → chunk-integrations-globals.3df36e26.mjs} +7 -7
- package/dist/{chunk-runtime-chain.68f305d0.mjs → chunk-runtime-chain.6d23d202.mjs} +12 -57
- package/dist/{chunk-runtime-mocker.1c207219.mjs → chunk-runtime-mocker.34b9d585.mjs} +10 -10
- package/dist/{chunk-runtime-rpc.5e78af38.mjs → chunk-runtime-rpc.d986adb9.mjs} +1 -1
- package/dist/{chunk-utils-global.79a8b1cc.mjs → chunk-utils-global.4828c2e2.mjs} +66 -2
- package/dist/{chunk-utils-source-map.f52527bc.mjs → chunk-utils-source-map.a9047343.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.1efbe319.mjs → chunk-vite-node-externalize.0fc8ed68.mjs} +76 -56
- package/dist/{chunk-vite-node-utils.4b58ae05.mjs → chunk-vite-node-utils.0f776286.mjs} +15 -12
- package/dist/cli.mjs +9 -9
- package/dist/config.cjs +5 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/entry.mjs +6 -6
- package/dist/index.d.ts +42 -2
- package/dist/index.mjs +4 -4
- package/dist/node.d.ts +49 -2
- package/dist/node.mjs +9 -9
- package/dist/{vendor-entry.2edaf3e0.mjs → vendor-entry.1ad8a08d.mjs} +17 -10
- package/dist/{vendor-index.e5dc6622.mjs → vendor-index.a2a385d8.mjs} +0 -0
- package/dist/worker.mjs +8 -8
- 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.0f776286.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.27550afb.mjs';
|
|
13
|
+
import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.a9047343.mjs';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-utils-global.
|
|
16
|
+
import './chunk-utils-global.4828c2e2.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 {
|
|
2
|
+
import { q as resolve } from './chunk-utils-global.4828c2e2.mjs';
|
|
3
3
|
|
|
4
4
|
const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
|
|
5
5
|
const defaultPort = 51204;
|
|
@@ -2,7 +2,7 @@ import { importModule } from 'local-pkg';
|
|
|
2
2
|
import { existsSync, promises } from 'fs';
|
|
3
3
|
import { createRequire } from 'module';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
|
-
import {
|
|
5
|
+
import { F as toArray, q as resolve } from './chunk-utils-global.4828c2e2.mjs';
|
|
6
6
|
|
|
7
7
|
var node = {
|
|
8
8
|
name: "node",
|
|
@@ -237,7 +237,8 @@ const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
|
|
|
237
237
|
|
|
238
238
|
const allowRewrite = [
|
|
239
239
|
"Event",
|
|
240
|
-
"EventTarget"
|
|
240
|
+
"EventTarget",
|
|
241
|
+
"MessageEvent"
|
|
241
242
|
];
|
|
242
243
|
const skipKeys = [
|
|
243
244
|
"window",
|
|
@@ -575,7 +576,11 @@ const config = {
|
|
|
575
576
|
hookTimeout: 1e4,
|
|
576
577
|
isolate: true,
|
|
577
578
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
578
|
-
forceRerunTriggers: [
|
|
579
|
+
forceRerunTriggers: [
|
|
580
|
+
"**/package.json/**",
|
|
581
|
+
"**/vitest.config.*/**",
|
|
582
|
+
"**/vite.config.*/**"
|
|
583
|
+
],
|
|
579
584
|
update: false,
|
|
580
585
|
reporters: [],
|
|
581
586
|
silent: false,
|
|
@@ -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.a2a385d8.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.6bb781c7.mjs → chunk-integrations-globals.3df36e26.mjs}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.
|
|
2
|
-
import { i as index } from './vendor-entry.
|
|
1
|
+
import { g as globalApis } from './chunk-constants.27550afb.mjs';
|
|
2
|
+
import { i as index } from './vendor-entry.1ad8a08d.mjs';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './chunk-utils-global.
|
|
4
|
+
import './chunk-utils-global.4828c2e2.mjs';
|
|
5
5
|
import 'tty';
|
|
6
6
|
import 'local-pkg';
|
|
7
7
|
import 'path';
|
|
8
8
|
import 'fs';
|
|
9
|
-
import './chunk-env-node.
|
|
9
|
+
import './chunk-env-node.aa51c4cc.mjs';
|
|
10
10
|
import 'module';
|
|
11
|
-
import './chunk-runtime-chain.
|
|
11
|
+
import './chunk-runtime-chain.6d23d202.mjs';
|
|
12
12
|
import 'chai';
|
|
13
13
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
14
|
-
import './chunk-runtime-rpc.
|
|
15
|
-
import './chunk-utils-source-map.
|
|
14
|
+
import './chunk-runtime-rpc.d986adb9.mjs';
|
|
15
|
+
import './chunk-utils-source-map.a9047343.mjs';
|
|
16
16
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
17
17
|
import 'tinyspy';
|
|
18
18
|
import 'util';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chai$1, { expect, 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 getFullName, f as safeSetTimeout, h as safeClearTimeout, n as noop, r as resetModules } from './chunk-utils-global.
|
|
3
|
+
import { r as rpc } from './chunk-runtime-rpc.d986adb9.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 getFullName, f as safeSetTimeout, h as safeClearTimeout, n as noop, R as RealDate, r as resetDate, m as mockDate, k as resetModules } from './chunk-utils-global.4828c2e2.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.a9047343.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
|
|
|
@@ -1884,7 +1884,8 @@ function formatTitle(template, items, idx) {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
const describe = suite;
|
|
1886
1886
|
const it = test;
|
|
1887
|
-
const
|
|
1887
|
+
const workerState = getWorkerState();
|
|
1888
|
+
const defaultSuite = workerState.config.sequence.shuffle ? suite.shuffle("") : suite("");
|
|
1888
1889
|
function clearCollectorContext() {
|
|
1889
1890
|
collectorContext.tasks.length = 0;
|
|
1890
1891
|
defaultSuite.clear();
|
|
@@ -1902,7 +1903,7 @@ function createSuiteHooks() {
|
|
|
1902
1903
|
};
|
|
1903
1904
|
}
|
|
1904
1905
|
function createSuiteCollector(name, factory = () => {
|
|
1905
|
-
}, mode, concurrent) {
|
|
1906
|
+
}, mode, concurrent, shuffle) {
|
|
1906
1907
|
const tasks = [];
|
|
1907
1908
|
const factoryQueue = [];
|
|
1908
1909
|
let suite2;
|
|
@@ -1919,6 +1920,8 @@ function createSuiteCollector(name, factory = () => {
|
|
|
1919
1920
|
};
|
|
1920
1921
|
if (this.concurrent || concurrent)
|
|
1921
1922
|
test3.concurrent = true;
|
|
1923
|
+
if (shuffle)
|
|
1924
|
+
test3.shuffle = true;
|
|
1922
1925
|
const context = createTestContext(test3);
|
|
1923
1926
|
Object.defineProperty(test3, "context", {
|
|
1924
1927
|
value: context,
|
|
@@ -1946,6 +1949,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
1946
1949
|
type: "suite",
|
|
1947
1950
|
name,
|
|
1948
1951
|
mode,
|
|
1952
|
+
shuffle,
|
|
1949
1953
|
tasks: []
|
|
1950
1954
|
};
|
|
1951
1955
|
setHooks(suite2, createSuiteHooks());
|
|
@@ -1975,9 +1979,9 @@ function createSuiteCollector(name, factory = () => {
|
|
|
1975
1979
|
return collector;
|
|
1976
1980
|
}
|
|
1977
1981
|
function createSuite() {
|
|
1978
|
-
const suite2 = createChainable(["concurrent", "skip", "only", "todo"], function(name, factory) {
|
|
1982
|
+
const suite2 = createChainable(["concurrent", "shuffle", "skip", "only", "todo"], function(name, factory) {
|
|
1979
1983
|
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
1980
|
-
return createSuiteCollector(name, factory, mode, this.concurrent);
|
|
1984
|
+
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle);
|
|
1981
1985
|
});
|
|
1982
1986
|
suite2.each = (cases) => {
|
|
1983
1987
|
return (name, fn) => {
|
|
@@ -4548,55 +4552,6 @@ defaultImplementation.createClock;
|
|
|
4548
4552
|
defaultImplementation.install;
|
|
4549
4553
|
var withGlobal_1 = withGlobal;
|
|
4550
4554
|
|
|
4551
|
-
const RealDate = Date;
|
|
4552
|
-
let now = null;
|
|
4553
|
-
class MockDate extends RealDate {
|
|
4554
|
-
constructor(y, m, d, h, M, s, ms) {
|
|
4555
|
-
super();
|
|
4556
|
-
let date;
|
|
4557
|
-
switch (arguments.length) {
|
|
4558
|
-
case 0:
|
|
4559
|
-
if (now !== null)
|
|
4560
|
-
date = new RealDate(now.valueOf());
|
|
4561
|
-
else
|
|
4562
|
-
date = new RealDate();
|
|
4563
|
-
break;
|
|
4564
|
-
case 1:
|
|
4565
|
-
date = new RealDate(y);
|
|
4566
|
-
break;
|
|
4567
|
-
default:
|
|
4568
|
-
d = typeof d === "undefined" ? 1 : d;
|
|
4569
|
-
h = h || 0;
|
|
4570
|
-
M = M || 0;
|
|
4571
|
-
s = s || 0;
|
|
4572
|
-
ms = ms || 0;
|
|
4573
|
-
date = new RealDate(y, m, d, h, M, s, ms);
|
|
4574
|
-
break;
|
|
4575
|
-
}
|
|
4576
|
-
return date;
|
|
4577
|
-
}
|
|
4578
|
-
}
|
|
4579
|
-
MockDate.UTC = RealDate.UTC;
|
|
4580
|
-
MockDate.now = function() {
|
|
4581
|
-
return new MockDate().valueOf();
|
|
4582
|
-
};
|
|
4583
|
-
MockDate.parse = function(dateString) {
|
|
4584
|
-
return RealDate.parse(dateString);
|
|
4585
|
-
};
|
|
4586
|
-
MockDate.toString = function() {
|
|
4587
|
-
return RealDate.toString();
|
|
4588
|
-
};
|
|
4589
|
-
function mockDate(date) {
|
|
4590
|
-
const dateObj = new RealDate(date.valueOf());
|
|
4591
|
-
if (isNaN(dateObj.getTime()))
|
|
4592
|
-
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
4593
|
-
globalThis.Date = MockDate;
|
|
4594
|
-
now = dateObj.valueOf();
|
|
4595
|
-
}
|
|
4596
|
-
function resetDate() {
|
|
4597
|
-
globalThis.Date = RealDate;
|
|
4598
|
-
}
|
|
4599
|
-
|
|
4600
4555
|
class FakeTimers {
|
|
4601
4556
|
constructor({
|
|
4602
4557
|
global,
|
|
@@ -4844,4 +4799,4 @@ function isWatchMode() {
|
|
|
4844
4799
|
return getRunningMode() === "watch";
|
|
4845
4800
|
}
|
|
4846
4801
|
|
|
4847
|
-
export { getState as A, GLOBAL_EXPECT as G,
|
|
4802
|
+
export { getState as A, GLOBAL_EXPECT as G, isFirstRun as a, beforeAll as b, afterAll as c, describe as d, beforeEach as e, afterEach as f, createExpect as g, globalExpect as h, it as i, vi as j, getRunningMode as k, isWatchMode as l, resetRunOnceCounter as m, clearCollectorContext as n, defaultSuite as o, setHooks as p, getHooks as q, runOnce as r, suite as s, test as t, collectorContext as u, vitest as v, withCallback as w, getSnapshotClient as x, setState as y, getFn as z };
|
|
@@ -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.0f776286.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { a as getWorkerState,
|
|
3
|
+
import { a as getWorkerState, M as isWindows, N as mergeSlashes, d as dirname, j as join, o as basename, q as resolve, O as getType, P as getAllProperties, s as slash } from './chunk-utils-global.4828c2e2.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
+
import { d as distDir } from './chunk-constants.27550afb.mjs';
|
|
6
6
|
|
|
7
7
|
const _VitestMocker = class {
|
|
8
8
|
constructor(options, moduleCache, request) {
|
|
@@ -74,7 +74,7 @@ const _VitestMocker = class {
|
|
|
74
74
|
const path = normalizeRequestId(external || mockPath);
|
|
75
75
|
if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
|
|
76
76
|
const mockDirname = dirname(path);
|
|
77
|
-
const mockFolder =
|
|
77
|
+
const mockFolder = join(this.root, "__mocks__", mockDirname);
|
|
78
78
|
if (!existsSync(mockFolder))
|
|
79
79
|
return null;
|
|
80
80
|
const files = readdirSync(mockFolder);
|
|
@@ -82,14 +82,14 @@ const _VitestMocker = class {
|
|
|
82
82
|
for (const file of files) {
|
|
83
83
|
const [basename2] = file.split(".");
|
|
84
84
|
if (basename2 === baseFilename)
|
|
85
|
-
return resolve(mockFolder, file)
|
|
85
|
+
return resolve(mockFolder, file);
|
|
86
86
|
}
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
89
|
const dir = dirname(path);
|
|
90
90
|
const baseId = basename(path);
|
|
91
91
|
const fullPath = resolve(dir, "__mocks__", baseId);
|
|
92
|
-
return existsSync(fullPath) ? fullPath
|
|
92
|
+
return existsSync(fullPath) ? fullPath : null;
|
|
93
93
|
}
|
|
94
94
|
mockValue(value) {
|
|
95
95
|
if (!_VitestMocker.spyModule) {
|
|
@@ -135,17 +135,17 @@ const _VitestMocker = class {
|
|
|
135
135
|
}
|
|
136
136
|
async importMock(id, importer) {
|
|
137
137
|
const { path, external } = await this.resolvePath(id, importer);
|
|
138
|
-
|
|
138
|
+
const fsPath = this.getFsPath(path, external);
|
|
139
|
+
let mock = this.getDependencyMock(fsPath);
|
|
139
140
|
if (mock === void 0)
|
|
140
|
-
mock = this.resolveMockPath(
|
|
141
|
+
mock = this.resolveMockPath(fsPath, external);
|
|
141
142
|
if (mock === null) {
|
|
142
143
|
await this.ensureSpy();
|
|
143
|
-
const fsPath = this.getFsPath(path, external);
|
|
144
144
|
const mod = await this.request(fsPath);
|
|
145
145
|
return this.mockValue(mod);
|
|
146
146
|
}
|
|
147
147
|
if (typeof mock === "function")
|
|
148
|
-
return this.callFunctionMock(
|
|
148
|
+
return this.callFunctionMock(fsPath, mock);
|
|
149
149
|
return this.requestWithMock(mock);
|
|
150
150
|
}
|
|
151
151
|
async ensureSpy() {
|
|
@@ -250,6 +250,55 @@ function getWorkerState() {
|
|
|
250
250
|
return globalThis.__vitest_worker__;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
const RealDate = Date;
|
|
254
|
+
let now = null;
|
|
255
|
+
class MockDate extends RealDate {
|
|
256
|
+
constructor(y, m, d, h, M, s, ms) {
|
|
257
|
+
super();
|
|
258
|
+
let date;
|
|
259
|
+
switch (arguments.length) {
|
|
260
|
+
case 0:
|
|
261
|
+
if (now !== null)
|
|
262
|
+
date = new RealDate(now.valueOf());
|
|
263
|
+
else
|
|
264
|
+
date = new RealDate();
|
|
265
|
+
break;
|
|
266
|
+
case 1:
|
|
267
|
+
date = new RealDate(y);
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
d = typeof d === "undefined" ? 1 : d;
|
|
271
|
+
h = h || 0;
|
|
272
|
+
M = M || 0;
|
|
273
|
+
s = s || 0;
|
|
274
|
+
ms = ms || 0;
|
|
275
|
+
date = new RealDate(y, m, d, h, M, s, ms);
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
return date;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
MockDate.UTC = RealDate.UTC;
|
|
282
|
+
MockDate.now = function() {
|
|
283
|
+
return new MockDate().valueOf();
|
|
284
|
+
};
|
|
285
|
+
MockDate.parse = function(dateString) {
|
|
286
|
+
return RealDate.parse(dateString);
|
|
287
|
+
};
|
|
288
|
+
MockDate.toString = function() {
|
|
289
|
+
return RealDate.toString();
|
|
290
|
+
};
|
|
291
|
+
function mockDate(date) {
|
|
292
|
+
const dateObj = new RealDate(date.valueOf());
|
|
293
|
+
if (isNaN(dateObj.getTime()))
|
|
294
|
+
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
295
|
+
globalThis.Date = MockDate;
|
|
296
|
+
now = dateObj.valueOf();
|
|
297
|
+
}
|
|
298
|
+
function resetDate() {
|
|
299
|
+
globalThis.Date = RealDate;
|
|
300
|
+
}
|
|
301
|
+
|
|
253
302
|
function isFinalObj(obj) {
|
|
254
303
|
return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
|
|
255
304
|
}
|
|
@@ -358,6 +407,21 @@ function assertTypes(value, name, types) {
|
|
|
358
407
|
function stdout() {
|
|
359
408
|
return console._stdout || process.stdout;
|
|
360
409
|
}
|
|
410
|
+
function random(seed) {
|
|
411
|
+
const x = Math.sin(seed++) * 1e4;
|
|
412
|
+
return x - Math.floor(x);
|
|
413
|
+
}
|
|
414
|
+
function shuffle(array, seed = RealDate.now()) {
|
|
415
|
+
let length = array.length;
|
|
416
|
+
while (length) {
|
|
417
|
+
const index = Math.floor(random(seed) * length--);
|
|
418
|
+
const previous = array[length];
|
|
419
|
+
array[length] = array[index];
|
|
420
|
+
array[index] = previous;
|
|
421
|
+
++seed;
|
|
422
|
+
}
|
|
423
|
+
return array;
|
|
424
|
+
}
|
|
361
425
|
|
|
362
426
|
function getTests(suite) {
|
|
363
427
|
return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
|
|
@@ -466,7 +530,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
466
530
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
467
531
|
});
|
|
468
532
|
if (install) {
|
|
469
|
-
await (await import('./chunk-install-pkg.
|
|
533
|
+
await (await import('./chunk-install-pkg.6f5930c3.mjs')).installPackage(dependency, { dev: true });
|
|
470
534
|
process.stderr.write(picocolors.exports.yellow(`
|
|
471
535
|
Package ${dependency} installed, re-run the command to start.
|
|
472
536
|
`));
|
|
@@ -510,4 +574,4 @@ class AggregateErrorPonyfill extends Error {
|
|
|
510
574
|
}
|
|
511
575
|
}
|
|
512
576
|
|
|
513
|
-
export { AggregateErrorPonyfill as A,
|
|
577
|
+
export { AggregateErrorPonyfill as A, getSuites as B, safeSetInterval as C, safeClearInterval as D, shuffle as E, toArray as F, normalize as G, deepMerge as H, toNamespacedPath as I, ensurePackageInstalled as J, stdout as K, extname as L, isWindows as M, mergeSlashes as N, getType as O, getAllProperties as P, deepClone as Q, RealDate as R, partitionSuiteChildren as S, hasTests as T, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, getFullName as e, safeSetTimeout as f, getCallLastIndex as g, safeClearTimeout as h, isObject as i, join as j, resetModules as k, notNullish as l, mockDate as m, noop as n, basename as o, picocolors as p, resolve as q, resetDate as r, slash as s, isAbsolute as t, relative as u, isNode as v, withSafeTimers as w, getTests as x, hasFailed as y, hasFailedSnapshot as z };
|
package/dist/{chunk-vite-node-externalize.1efbe319.mjs → chunk-vite-node-externalize.0fc8ed68.mjs}
RENAMED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, e as envPackageNames } from './chunk-env-node.
|
|
2
|
-
import { j as join,
|
|
1
|
+
import { p as pLimit, c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage, e as envPackageNames } from './chunk-env-node.aa51c4cc.mjs';
|
|
2
|
+
import { j as join, o as basename, d as dirname, q as resolve, A as AggregateErrorPonyfill, p as picocolors, s as slash$2, t as isAbsolute, u as relative, v as isNode, x as getTests, e as getFullName, y as hasFailed, z as hasFailedSnapshot, B as getSuites, C as safeSetInterval, D as safeClearInterval, f as safeSetTimeout, E as shuffle, F as toArray$1, G as normalize, n as noop$1, h as safeClearTimeout, H as deepMerge, I as toNamespacedPath, g as getCallLastIndex, l as notNullish, J as ensurePackageInstalled, K as stdout } from './chunk-utils-global.4828c2e2.mjs';
|
|
3
3
|
import { loadConfigFromFile, createServer, mergeConfig } from 'vite';
|
|
4
4
|
import path$a from 'path';
|
|
5
5
|
import url, { fileURLToPath, pathToFileURL } from 'url';
|
|
6
6
|
import process$1 from 'process';
|
|
7
7
|
import fs$8, { promises, existsSync, readFileSync } from 'fs';
|
|
8
|
-
import { d as distDir, c as configFiles, a as defaultPort } from './chunk-constants.
|
|
8
|
+
import { d as distDir, c as configFiles, a as defaultPort } from './chunk-constants.27550afb.mjs';
|
|
9
9
|
import readline from 'readline';
|
|
10
10
|
import require$$0, { cpus, hostname, constants as constants$5 } from 'os';
|
|
11
11
|
import require$$0$1 from 'util';
|
|
12
12
|
import require$$0$2 from 'stream';
|
|
13
13
|
import require$$2 from 'events';
|
|
14
14
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
15
|
-
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.
|
|
15
|
+
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.0f776286.mjs';
|
|
16
16
|
import createDebug from 'debug';
|
|
17
17
|
import { MessageChannel } from 'worker_threads';
|
|
18
18
|
import { Tinypool } from 'tinypool';
|
|
19
|
-
import { createHash } from 'crypto';
|
|
20
19
|
import { performance } from 'perf_hooks';
|
|
21
|
-
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.
|
|
22
|
-
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.a9047343.mjs';
|
|
21
|
+
import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.a2a385d8.mjs';
|
|
23
22
|
import { resolveModule } from 'local-pkg';
|
|
23
|
+
import { createHash } from 'crypto';
|
|
24
24
|
import { Buffer } from 'buffer';
|
|
25
25
|
import childProcess from 'child_process';
|
|
26
26
|
import MagicString from './chunk-magic-string.efe26975.mjs';
|
|
27
27
|
import { p as prompts } from './vendor-index.98e769c1.mjs';
|
|
28
28
|
|
|
29
|
-
var version = "0.17.
|
|
29
|
+
var version = "0.17.1";
|
|
30
30
|
|
|
31
31
|
class EndError extends Error {
|
|
32
32
|
constructor(value) {
|
|
@@ -6979,50 +6979,10 @@ function addSnapshotResult(summary, result) {
|
|
|
6979
6979
|
summary.total += result.added + result.matched + result.unmatched + result.updated;
|
|
6980
6980
|
}
|
|
6981
6981
|
|
|
6982
|
-
class BaseSequelizer {
|
|
6983
|
-
constructor(ctx) {
|
|
6984
|
-
this.ctx = ctx;
|
|
6985
|
-
}
|
|
6986
|
-
async shard(files) {
|
|
6987
|
-
const { config } = this.ctx;
|
|
6988
|
-
const { index, count } = config.shard;
|
|
6989
|
-
const shardSize = Math.ceil(files.length / count);
|
|
6990
|
-
const shardStart = shardSize * (index - 1);
|
|
6991
|
-
const shardEnd = shardSize * index;
|
|
6992
|
-
return [...files].map((file) => {
|
|
6993
|
-
const fullPath = resolve(slash$1(config.root), slash$1(file));
|
|
6994
|
-
const specPath = fullPath == null ? void 0 : fullPath.slice(config.root.length);
|
|
6995
|
-
return {
|
|
6996
|
-
file,
|
|
6997
|
-
hash: createHash("sha1").update(specPath).digest("hex")
|
|
6998
|
-
};
|
|
6999
|
-
}).sort((a, b) => a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0).slice(shardStart, shardEnd).map(({ file }) => file);
|
|
7000
|
-
}
|
|
7001
|
-
async sort(files) {
|
|
7002
|
-
const { state } = this.ctx;
|
|
7003
|
-
return [...files].sort((a, b) => {
|
|
7004
|
-
const aState = state.getFileTestResults(a);
|
|
7005
|
-
const bState = state.getFileTestResults(b);
|
|
7006
|
-
if (!aState || !bState) {
|
|
7007
|
-
const statsA = state.getFileStats(a);
|
|
7008
|
-
const statsB = state.getFileStats(b);
|
|
7009
|
-
if (!statsA || !statsB)
|
|
7010
|
-
return !statsA && statsB ? -1 : !statsB && statsA ? 1 : 0;
|
|
7011
|
-
return statsB.size - statsA.size;
|
|
7012
|
-
}
|
|
7013
|
-
if (aState.failed && !bState.failed)
|
|
7014
|
-
return -1;
|
|
7015
|
-
if (!aState.failed && bState.failed)
|
|
7016
|
-
return 1;
|
|
7017
|
-
return bState.duration - aState.duration;
|
|
7018
|
-
});
|
|
7019
|
-
}
|
|
7020
|
-
}
|
|
7021
|
-
|
|
7022
6982
|
const workerPath = pathToFileURL(resolve(distDir, "./worker.mjs")).href;
|
|
7023
6983
|
function createPool(ctx) {
|
|
7024
6984
|
var _a;
|
|
7025
|
-
const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
|
|
6985
|
+
const threadsCount = ctx.config.watch ? Math.max(Math.floor(cpus().length / 2), 1) : Math.max(cpus().length - 1, 1);
|
|
7026
6986
|
const maxThreads = ctx.config.maxThreads ?? threadsCount;
|
|
7027
6987
|
const minThreads = ctx.config.minThreads ?? threadsCount;
|
|
7028
6988
|
const options = {
|
|
@@ -7070,12 +7030,13 @@ function createPool(ctx) {
|
|
|
7070
7030
|
workerPort.close();
|
|
7071
7031
|
}
|
|
7072
7032
|
}
|
|
7073
|
-
const
|
|
7033
|
+
const Sequencer = ctx.config.sequence.sequencer;
|
|
7034
|
+
const sequencer = new Sequencer(ctx);
|
|
7074
7035
|
return async (files, invalidates) => {
|
|
7075
7036
|
const config = ctx.getSerializableConfig();
|
|
7076
7037
|
if (config.shard)
|
|
7077
|
-
files = await
|
|
7078
|
-
files = await
|
|
7038
|
+
files = await sequencer.shard(files);
|
|
7039
|
+
files = await sequencer.sort(files);
|
|
7079
7040
|
if (!ctx.config.threads) {
|
|
7080
7041
|
await runFiles(config, files);
|
|
7081
7042
|
} else {
|
|
@@ -8860,6 +8821,54 @@ class VitestCache {
|
|
|
8860
8821
|
}
|
|
8861
8822
|
}
|
|
8862
8823
|
|
|
8824
|
+
class BaseSequencer {
|
|
8825
|
+
constructor(ctx) {
|
|
8826
|
+
this.ctx = ctx;
|
|
8827
|
+
}
|
|
8828
|
+
async shard(files) {
|
|
8829
|
+
const { config } = this.ctx;
|
|
8830
|
+
const { index, count } = config.shard;
|
|
8831
|
+
const shardSize = Math.ceil(files.length / count);
|
|
8832
|
+
const shardStart = shardSize * (index - 1);
|
|
8833
|
+
const shardEnd = shardSize * index;
|
|
8834
|
+
return [...files].map((file) => {
|
|
8835
|
+
const fullPath = resolve(slash$1(config.root), slash$1(file));
|
|
8836
|
+
const specPath = fullPath == null ? void 0 : fullPath.slice(config.root.length);
|
|
8837
|
+
return {
|
|
8838
|
+
file,
|
|
8839
|
+
hash: createHash("sha1").update(specPath).digest("hex")
|
|
8840
|
+
};
|
|
8841
|
+
}).sort((a, b) => a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0).slice(shardStart, shardEnd).map(({ file }) => file);
|
|
8842
|
+
}
|
|
8843
|
+
async sort(files) {
|
|
8844
|
+
const { state } = this.ctx;
|
|
8845
|
+
return [...files].sort((a, b) => {
|
|
8846
|
+
const aState = state.getFileTestResults(a);
|
|
8847
|
+
const bState = state.getFileTestResults(b);
|
|
8848
|
+
if (!aState || !bState) {
|
|
8849
|
+
const statsA = state.getFileStats(a);
|
|
8850
|
+
const statsB = state.getFileStats(b);
|
|
8851
|
+
if (!statsA || !statsB)
|
|
8852
|
+
return !statsA && statsB ? -1 : !statsB && statsA ? 1 : 0;
|
|
8853
|
+
return statsB.size - statsA.size;
|
|
8854
|
+
}
|
|
8855
|
+
if (aState.failed && !bState.failed)
|
|
8856
|
+
return -1;
|
|
8857
|
+
if (!aState.failed && bState.failed)
|
|
8858
|
+
return 1;
|
|
8859
|
+
return bState.duration - aState.duration;
|
|
8860
|
+
});
|
|
8861
|
+
}
|
|
8862
|
+
}
|
|
8863
|
+
|
|
8864
|
+
class RandomSequencer extends BaseSequencer {
|
|
8865
|
+
async sort(files) {
|
|
8866
|
+
const { sequence } = this.ctx.config;
|
|
8867
|
+
const seed = (sequence == null ? void 0 : sequence.seed) ?? Date.now();
|
|
8868
|
+
return shuffle(files, seed);
|
|
8869
|
+
}
|
|
8870
|
+
}
|
|
8871
|
+
|
|
8863
8872
|
const extraInlineDeps = [
|
|
8864
8873
|
/^(?!.*(?:node_modules)).*\.mjs$/,
|
|
8865
8874
|
/^(?!.*(?:node_modules)).*\.cjs\.js$/,
|
|
@@ -8896,7 +8905,7 @@ function resolveApiConfig(options) {
|
|
|
8896
8905
|
return api;
|
|
8897
8906
|
}
|
|
8898
8907
|
function resolveConfig(options, viteConfig) {
|
|
8899
|
-
var _a, _b, _c;
|
|
8908
|
+
var _a, _b, _c, _d;
|
|
8900
8909
|
if (options.dom) {
|
|
8901
8910
|
if (((_a = viteConfig.test) == null ? void 0 : _a.environment) != null && viteConfig.test.environment !== "happy-dom") {
|
|
8902
8911
|
console.warn(picocolors.exports.yellow(`${picocolors.exports.inverse(picocolors.exports.yellow(" Vitest "))} Your config.test.environment ("${viteConfig.test.environment}") conflicts with --dom flag ("happy-dom"), ignoring "${viteConfig.test.environment}"`));
|
|
@@ -8965,6 +8974,10 @@ function resolveConfig(options, viteConfig) {
|
|
|
8965
8974
|
resolved.cache ?? (resolved.cache = { dir: "" });
|
|
8966
8975
|
if (resolved.cache)
|
|
8967
8976
|
resolved.cache.dir = VitestCache.resolveCacheDir(resolved.root, resolved.cache.dir);
|
|
8977
|
+
if (!((_d = resolved.sequence) == null ? void 0 : _d.sequencer)) {
|
|
8978
|
+
resolved.sequence ?? (resolved.sequence = {});
|
|
8979
|
+
resolved.sequence.sequencer = resolved.sequence.shuffle ? RandomSequencer : BaseSequencer;
|
|
8980
|
+
}
|
|
8968
8981
|
return resolved;
|
|
8969
8982
|
}
|
|
8970
8983
|
|
|
@@ -10320,7 +10333,11 @@ class Vitest {
|
|
|
10320
10333
|
...this.config.snapshotOptions,
|
|
10321
10334
|
resolveSnapshotPath: void 0
|
|
10322
10335
|
},
|
|
10323
|
-
onConsoleLog: void 0
|
|
10336
|
+
onConsoleLog: void 0,
|
|
10337
|
+
sequence: {
|
|
10338
|
+
...this.config.sequence,
|
|
10339
|
+
sequencer: void 0
|
|
10340
|
+
}
|
|
10324
10341
|
}, this.configOverride || {});
|
|
10325
10342
|
}
|
|
10326
10343
|
async start(filters) {
|
|
@@ -10382,6 +10399,9 @@ class Vitest {
|
|
|
10382
10399
|
const related = this.config.related;
|
|
10383
10400
|
if (!related)
|
|
10384
10401
|
return tests;
|
|
10402
|
+
const forceRerunTriggers = this.config.forceRerunTriggers;
|
|
10403
|
+
if (forceRerunTriggers.length && micromatch_1(related, forceRerunTriggers).length)
|
|
10404
|
+
return tests;
|
|
10385
10405
|
if (!related.length)
|
|
10386
10406
|
return [];
|
|
10387
10407
|
const testDeps = await Promise.all(tests.map(async (filepath) => {
|
|
@@ -10952,7 +10972,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
|
|
|
10952
10972
|
await ctx.setServer(options, server);
|
|
10953
10973
|
haveStarted = true;
|
|
10954
10974
|
if (options.api && options.watch)
|
|
10955
|
-
(await import('./chunk-api-setup.
|
|
10975
|
+
(await import('./chunk-api-setup.c728e251.mjs')).setup(ctx);
|
|
10956
10976
|
} catch (err) {
|
|
10957
10977
|
ctx.printError(err, true);
|
|
10958
10978
|
process.exit(1);
|
|
@@ -11101,4 +11121,4 @@ async function startVitest(cliFilters, options, viteOverrides) {
|
|
|
11101
11121
|
return true;
|
|
11102
11122
|
}
|
|
11103
11123
|
|
|
11104
|
-
export { VitestPlugin as V, createVitest as c, divider as d, startVitest as s, version as v };
|
|
11124
|
+
export { BaseSequencer as B, VitestPlugin as V, createVitest as c, divider as d, startVitest as s, version as v };
|
|
@@ -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 {
|
|
4
|
+
import { t as isAbsolute$2, q as resolve, j as join$2, L as extname$2, d as dirname$2 } from './chunk-utils-global.4828c2e2.mjs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
|
|
7
7
|
import assert from 'assert';
|
|
@@ -8860,10 +8860,10 @@ function isPrimitive(v) {
|
|
|
8860
8860
|
return v !== Object(v);
|
|
8861
8861
|
}
|
|
8862
8862
|
function toFilePath(id, root) {
|
|
8863
|
-
let absolute =
|
|
8863
|
+
let absolute = id.startsWith("/@fs/") ? id.slice(4) : id.startsWith(root) ? id : id.startsWith("/") ? resolve(root, id.slice(1)) : id;
|
|
8864
8864
|
if (absolute.startsWith("//"))
|
|
8865
8865
|
absolute = absolute.slice(1);
|
|
8866
|
-
return isWindows && absolute.startsWith("/") ? fileURLToPath$2(pathToFileURL(absolute.slice(1)).href) : absolute;
|
|
8866
|
+
return isWindows && absolute.startsWith("/") ? slash(fileURLToPath$2(pathToFileURL(absolute.slice(1)).href)) : absolute;
|
|
8867
8867
|
}
|
|
8868
8868
|
let SOURCEMAPPING_URL = "sourceMa";
|
|
8869
8869
|
SOURCEMAPPING_URL += "ppingURL";
|
|
@@ -8946,31 +8946,34 @@ class ViteNodeRunner {
|
|
|
8946
8946
|
return await this.cachedRequest(id, []);
|
|
8947
8947
|
}
|
|
8948
8948
|
async cachedRequest(rawId, callstack) {
|
|
8949
|
-
var _a, _b;
|
|
8949
|
+
var _a, _b, _c, _d;
|
|
8950
8950
|
const id = normalizeRequestId(rawId, this.options.base);
|
|
8951
8951
|
const fsPath = toFilePath(id, this.root);
|
|
8952
|
-
if ((_a = this.moduleCache.get(fsPath)) == null ? void 0 : _a.
|
|
8953
|
-
return (_b = this.moduleCache.get(fsPath)) == null ? void 0 : _b.
|
|
8952
|
+
if (callstack.includes(fsPath) && ((_a = this.moduleCache.get(fsPath)) == null ? void 0 : _a.exports))
|
|
8953
|
+
return (_b = this.moduleCache.get(fsPath)) == null ? void 0 : _b.exports;
|
|
8954
|
+
if ((_c = this.moduleCache.get(fsPath)) == null ? void 0 : _c.promise)
|
|
8955
|
+
return (_d = this.moduleCache.get(fsPath)) == null ? void 0 : _d.promise;
|
|
8954
8956
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
8955
8957
|
this.moduleCache.set(fsPath, { promise });
|
|
8956
8958
|
return await promise;
|
|
8957
8959
|
}
|
|
8958
8960
|
async directRequest(id, fsPath, _callstack) {
|
|
8959
|
-
const callstack = [..._callstack,
|
|
8961
|
+
const callstack = [..._callstack, fsPath];
|
|
8960
8962
|
const request = async (dep) => {
|
|
8961
8963
|
var _a;
|
|
8964
|
+
const fsPath2 = toFilePath(normalizeRequestId(dep, this.options.base), this.root);
|
|
8962
8965
|
const getStack = () => {
|
|
8963
8966
|
return `stack:
|
|
8964
|
-
${[...callstack,
|
|
8967
|
+
${[...callstack, fsPath2].reverse().map((p) => `- ${p}`).join("\n")}`;
|
|
8965
8968
|
};
|
|
8966
8969
|
let debugTimer;
|
|
8967
8970
|
if (this.debug)
|
|
8968
|
-
debugTimer = setTimeout(() => this.debugLog(() => `module ${
|
|
8971
|
+
debugTimer = setTimeout(() => this.debugLog(() => `module ${fsPath2} takes over 2s to load.
|
|
8969
8972
|
${getStack()}`), 2e3);
|
|
8970
8973
|
try {
|
|
8971
|
-
if (callstack.includes(
|
|
8974
|
+
if (callstack.includes(fsPath2)) {
|
|
8972
8975
|
this.debugLog(() => `circular dependency, ${getStack()}`);
|
|
8973
|
-
const depExports = (_a = this.moduleCache.get(
|
|
8976
|
+
const depExports = (_a = this.moduleCache.get(fsPath2)) == null ? void 0 : _a.exports;
|
|
8974
8977
|
if (depExports)
|
|
8975
8978
|
return depExports;
|
|
8976
8979
|
throw new Error(`[vite-node] Failed to resolve circular dependency, ${getStack()}`);
|
|
@@ -9010,7 +9013,7 @@ ${getStack()}`), 2e3);
|
|
|
9010
9013
|
const meta = { url };
|
|
9011
9014
|
const exports = /* @__PURE__ */ Object.create(null);
|
|
9012
9015
|
exports[Symbol.toStringTag] = "Module";
|
|
9013
|
-
this.moduleCache.set(
|
|
9016
|
+
this.moduleCache.set(fsPath, { code: transformed, exports });
|
|
9014
9017
|
const __filename = fileURLToPath$2(url);
|
|
9015
9018
|
const moduleProxy = {
|
|
9016
9019
|
set exports(value) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
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.4828c2e2.mjs';
|
|
3
|
+
import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.0fc8ed68.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-env-node.
|
|
7
|
+
import './chunk-env-node.aa51c4cc.mjs';
|
|
8
8
|
import 'fs';
|
|
9
9
|
import 'module';
|
|
10
10
|
import 'url';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
13
|
+
import './chunk-constants.27550afb.mjs';
|
|
14
14
|
import 'readline';
|
|
15
15
|
import 'os';
|
|
16
16
|
import 'util';
|
|
17
17
|
import 'stream';
|
|
18
18
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
19
|
-
import './chunk-vite-node-utils.
|
|
19
|
+
import './chunk-vite-node-utils.0f776286.mjs';
|
|
20
20
|
import 'vm';
|
|
21
21
|
import 'assert';
|
|
22
22
|
import 'debug';
|
|
23
23
|
import 'worker_threads';
|
|
24
24
|
import 'tinypool';
|
|
25
|
-
import 'crypto';
|
|
26
25
|
import 'perf_hooks';
|
|
27
|
-
import './chunk-utils-source-map.
|
|
28
|
-
import './vendor-index.
|
|
26
|
+
import './chunk-utils-source-map.a9047343.mjs';
|
|
27
|
+
import './vendor-index.a2a385d8.mjs';
|
|
29
28
|
import 'child_process';
|
|
30
29
|
import 'buffer';
|
|
30
|
+
import 'crypto';
|
|
31
31
|
import './chunk-magic-string.efe26975.mjs';
|
|
32
32
|
import './vendor-index.98e769c1.mjs';
|
|
33
33
|
|
|
@@ -645,7 +645,7 @@ class CAC extends EventEmitter {
|
|
|
645
645
|
const cac = (name = "") => new CAC(name);
|
|
646
646
|
|
|
647
647
|
const cli = cac("vitest");
|
|
648
|
-
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("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
|
|
648
|
+
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("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").help();
|
|
649
649
|
cli.command("run [...filters]").action(run);
|
|
650
650
|
cli.command("related [...filters]").action(runRelated);
|
|
651
651
|
cli.command("watch [...filters]").action(start);
|
package/dist/config.cjs
CHANGED
|
@@ -55,7 +55,11 @@ const config = {
|
|
|
55
55
|
hookTimeout: 1e4,
|
|
56
56
|
isolate: true,
|
|
57
57
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
58
|
-
forceRerunTriggers: [
|
|
58
|
+
forceRerunTriggers: [
|
|
59
|
+
"**/package.json/**",
|
|
60
|
+
"**/vitest.config.*/**",
|
|
61
|
+
"**/vite.config.*/**"
|
|
62
|
+
],
|
|
59
63
|
update: false,
|
|
60
64
|
reporters: [],
|
|
61
65
|
silent: false,
|
package/dist/config.d.ts
CHANGED
package/dist/config.mjs
CHANGED
|
@@ -51,7 +51,11 @@ const config = {
|
|
|
51
51
|
hookTimeout: 1e4,
|
|
52
52
|
isolate: true,
|
|
53
53
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
54
|
-
forceRerunTriggers: [
|
|
54
|
+
forceRerunTriggers: [
|
|
55
|
+
"**/package.json/**",
|
|
56
|
+
"**/vitest.config.*/**",
|
|
57
|
+
"**/vite.config.*/**"
|
|
58
|
+
],
|
|
55
59
|
update: false,
|
|
56
60
|
reporters: [],
|
|
57
61
|
silent: false,
|
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.1ad8a08d.mjs';
|
|
2
2
|
import 'fs';
|
|
3
|
-
import './chunk-utils-global.
|
|
3
|
+
import './chunk-utils-global.4828c2e2.mjs';
|
|
4
4
|
import 'tty';
|
|
5
5
|
import 'local-pkg';
|
|
6
6
|
import 'path';
|
|
7
|
-
import './chunk-env-node.
|
|
7
|
+
import './chunk-env-node.aa51c4cc.mjs';
|
|
8
8
|
import 'module';
|
|
9
9
|
import 'url';
|
|
10
|
-
import './chunk-runtime-chain.
|
|
10
|
+
import './chunk-runtime-chain.6d23d202.mjs';
|
|
11
11
|
import 'chai';
|
|
12
12
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
13
|
-
import './chunk-runtime-rpc.
|
|
14
|
-
import './chunk-utils-source-map.
|
|
13
|
+
import './chunk-runtime-rpc.d986adb9.mjs';
|
|
14
|
+
import './chunk-utils-source-map.a9047343.mjs';
|
|
15
15
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
16
16
|
import 'tinyspy';
|
|
17
17
|
import 'util';
|
package/dist/index.d.ts
CHANGED
|
@@ -486,6 +486,18 @@ declare class Vitest {
|
|
|
486
486
|
|
|
487
487
|
declare type MockMap = Map<string, Record<string, string | null | (() => unknown)>>;
|
|
488
488
|
|
|
489
|
+
interface TestSequencer {
|
|
490
|
+
/**
|
|
491
|
+
* Slicing tests into shards. Will be run before `sort`.
|
|
492
|
+
* Only run, if `shard` is defined.
|
|
493
|
+
*/
|
|
494
|
+
shard(files: string[]): Awaitable<string[]>;
|
|
495
|
+
sort(files: string[]): Awaitable<string[]>;
|
|
496
|
+
}
|
|
497
|
+
interface TestSequencerContructor {
|
|
498
|
+
new (ctx: Vitest): TestSequencer;
|
|
499
|
+
}
|
|
500
|
+
|
|
489
501
|
declare abstract class BaseReporter implements Reporter {
|
|
490
502
|
start: number;
|
|
491
503
|
end: number;
|
|
@@ -815,6 +827,7 @@ interface TaskBase {
|
|
|
815
827
|
name: string;
|
|
816
828
|
mode: RunMode;
|
|
817
829
|
concurrent?: boolean;
|
|
830
|
+
shuffle?: boolean;
|
|
818
831
|
suite?: Suite;
|
|
819
832
|
file?: File;
|
|
820
833
|
result?: TaskResult;
|
|
@@ -876,7 +889,7 @@ declare type TestAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only
|
|
|
876
889
|
skipIf(condition: any): TestAPI<ExtraContext>;
|
|
877
890
|
runIf(condition: any): TestAPI<ExtraContext>;
|
|
878
891
|
};
|
|
879
|
-
declare type SuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo', [
|
|
892
|
+
declare type SuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'shuffle', [
|
|
880
893
|
name: string,
|
|
881
894
|
factory?: SuiteFactory
|
|
882
895
|
], SuiteCollector<ExtraContext>> & {
|
|
@@ -1291,6 +1304,28 @@ interface InlineConfig {
|
|
|
1291
1304
|
cache?: false | {
|
|
1292
1305
|
dir?: string;
|
|
1293
1306
|
};
|
|
1307
|
+
/**
|
|
1308
|
+
* Options for configuring the order of running tests.
|
|
1309
|
+
*/
|
|
1310
|
+
sequence?: {
|
|
1311
|
+
/**
|
|
1312
|
+
* Class that handles sorting and sharding algorithm.
|
|
1313
|
+
* If you only need to change sorting, you can extend
|
|
1314
|
+
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1315
|
+
* @default BaseSequencer
|
|
1316
|
+
*/
|
|
1317
|
+
sequencer?: TestSequencerContructor;
|
|
1318
|
+
/**
|
|
1319
|
+
* Should tests run in random order.
|
|
1320
|
+
* @default false
|
|
1321
|
+
*/
|
|
1322
|
+
shuffle?: boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* Seed for the random number generator.
|
|
1325
|
+
* @default Date.now()
|
|
1326
|
+
*/
|
|
1327
|
+
seed?: number;
|
|
1328
|
+
};
|
|
1294
1329
|
}
|
|
1295
1330
|
interface UserConfig extends InlineConfig {
|
|
1296
1331
|
/**
|
|
@@ -1330,7 +1365,7 @@ interface UserConfig extends InlineConfig {
|
|
|
1330
1365
|
*/
|
|
1331
1366
|
shard?: string;
|
|
1332
1367
|
}
|
|
1333
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache'> {
|
|
1368
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache' | 'sequence'> {
|
|
1334
1369
|
base?: string;
|
|
1335
1370
|
config?: string;
|
|
1336
1371
|
filters?: string[];
|
|
@@ -1348,6 +1383,11 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1348
1383
|
cache: {
|
|
1349
1384
|
dir: string;
|
|
1350
1385
|
} | false;
|
|
1386
|
+
sequence: {
|
|
1387
|
+
sequencer: TestSequencerContructor;
|
|
1388
|
+
shuffle?: boolean;
|
|
1389
|
+
seed?: number;
|
|
1390
|
+
};
|
|
1351
1391
|
}
|
|
1352
1392
|
|
|
1353
1393
|
declare type VitestInlineConfig = InlineConfig;
|
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.6d23d202.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.d986adb9.mjs';
|
|
5
|
+
import './chunk-utils-global.4828c2e2.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.a9047343.mjs';
|
|
11
11
|
import './chunk-integrations-spy.674b628e.mjs';
|
|
12
12
|
import 'tinyspy';
|
|
13
13
|
import 'util';
|
package/dist/node.d.ts
CHANGED
|
@@ -474,6 +474,18 @@ declare const ReportersMap: {
|
|
|
474
474
|
};
|
|
475
475
|
declare type BuiltinReporters = keyof typeof ReportersMap;
|
|
476
476
|
|
|
477
|
+
interface TestSequencer {
|
|
478
|
+
/**
|
|
479
|
+
* Slicing tests into shards. Will be run before `sort`.
|
|
480
|
+
* Only run, if `shard` is defined.
|
|
481
|
+
*/
|
|
482
|
+
shard(files: string[]): Awaitable<string[]>;
|
|
483
|
+
sort(files: string[]): Awaitable<string[]>;
|
|
484
|
+
}
|
|
485
|
+
interface TestSequencerContructor {
|
|
486
|
+
new (ctx: Vitest): TestSequencer;
|
|
487
|
+
}
|
|
488
|
+
|
|
477
489
|
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
478
490
|
declare type Arrayable<T> = T | Array<T>;
|
|
479
491
|
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
@@ -657,6 +669,7 @@ interface TaskBase {
|
|
|
657
669
|
name: string;
|
|
658
670
|
mode: RunMode;
|
|
659
671
|
concurrent?: boolean;
|
|
672
|
+
shuffle?: boolean;
|
|
660
673
|
suite?: Suite;
|
|
661
674
|
file?: File;
|
|
662
675
|
result?: TaskResult;
|
|
@@ -1080,6 +1093,28 @@ interface InlineConfig {
|
|
|
1080
1093
|
cache?: false | {
|
|
1081
1094
|
dir?: string;
|
|
1082
1095
|
};
|
|
1096
|
+
/**
|
|
1097
|
+
* Options for configuring the order of running tests.
|
|
1098
|
+
*/
|
|
1099
|
+
sequence?: {
|
|
1100
|
+
/**
|
|
1101
|
+
* Class that handles sorting and sharding algorithm.
|
|
1102
|
+
* If you only need to change sorting, you can extend
|
|
1103
|
+
* your custom sequencer from `BaseSequencer` from `vitest/node`.
|
|
1104
|
+
* @default BaseSequencer
|
|
1105
|
+
*/
|
|
1106
|
+
sequencer?: TestSequencerContructor;
|
|
1107
|
+
/**
|
|
1108
|
+
* Should tests run in random order.
|
|
1109
|
+
* @default false
|
|
1110
|
+
*/
|
|
1111
|
+
shuffle?: boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* Seed for the random number generator.
|
|
1114
|
+
* @default Date.now()
|
|
1115
|
+
*/
|
|
1116
|
+
seed?: number;
|
|
1117
|
+
};
|
|
1083
1118
|
}
|
|
1084
1119
|
interface UserConfig extends InlineConfig {
|
|
1085
1120
|
/**
|
|
@@ -1119,7 +1154,7 @@ interface UserConfig extends InlineConfig {
|
|
|
1119
1154
|
*/
|
|
1120
1155
|
shard?: string;
|
|
1121
1156
|
}
|
|
1122
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache'> {
|
|
1157
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'shard' | 'cache' | 'sequence'> {
|
|
1123
1158
|
base?: string;
|
|
1124
1159
|
config?: string;
|
|
1125
1160
|
filters?: string[];
|
|
@@ -1137,6 +1172,11 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
1137
1172
|
cache: {
|
|
1138
1173
|
dir: string;
|
|
1139
1174
|
} | false;
|
|
1175
|
+
sequence: {
|
|
1176
|
+
sequencer: TestSequencerContructor;
|
|
1177
|
+
shuffle?: boolean;
|
|
1178
|
+
seed?: number;
|
|
1179
|
+
};
|
|
1140
1180
|
}
|
|
1141
1181
|
|
|
1142
1182
|
declare type VitestInlineConfig = InlineConfig;
|
|
@@ -1582,4 +1622,11 @@ declare class VitestRunner extends ViteNodeRunner {
|
|
|
1582
1622
|
};
|
|
1583
1623
|
}
|
|
1584
1624
|
|
|
1585
|
-
|
|
1625
|
+
declare class BaseSequencer implements TestSequencer {
|
|
1626
|
+
protected ctx: Vitest;
|
|
1627
|
+
constructor(ctx: Vitest);
|
|
1628
|
+
shard(files: string[]): Promise<string[]>;
|
|
1629
|
+
sort(files: string[]): Promise<string[]>;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
export { BaseSequencer, ExecuteOptions, TestSequencer, TestSequencerContructor, Vitest, VitestPlugin, VitestRunner, createVitest, startVitest };
|
package/dist/node.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
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-env-node.
|
|
1
|
+
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.0fc8ed68.mjs';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.34b9d585.mjs';
|
|
3
|
+
import './chunk-env-node.aa51c4cc.mjs';
|
|
4
4
|
import 'local-pkg';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'module';
|
|
7
7
|
import 'url';
|
|
8
|
-
import './chunk-utils-global.
|
|
8
|
+
import './chunk-utils-global.4828c2e2.mjs';
|
|
9
9
|
import 'tty';
|
|
10
10
|
import 'path';
|
|
11
11
|
import 'vite';
|
|
12
12
|
import 'process';
|
|
13
|
-
import './chunk-constants.
|
|
13
|
+
import './chunk-constants.27550afb.mjs';
|
|
14
14
|
import 'readline';
|
|
15
15
|
import 'os';
|
|
16
16
|
import 'util';
|
|
17
17
|
import 'stream';
|
|
18
18
|
import 'events';
|
|
19
19
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
20
|
-
import './chunk-vite-node-utils.
|
|
20
|
+
import './chunk-vite-node-utils.0f776286.mjs';
|
|
21
21
|
import 'vm';
|
|
22
22
|
import 'assert';
|
|
23
23
|
import 'debug';
|
|
24
24
|
import 'worker_threads';
|
|
25
25
|
import 'tinypool';
|
|
26
|
-
import 'crypto';
|
|
27
26
|
import 'perf_hooks';
|
|
28
|
-
import './chunk-utils-source-map.
|
|
29
|
-
import './vendor-index.
|
|
27
|
+
import './chunk-utils-source-map.a9047343.mjs';
|
|
28
|
+
import './vendor-index.a2a385d8.mjs';
|
|
30
29
|
import 'child_process';
|
|
31
30
|
import 'buffer';
|
|
31
|
+
import 'crypto';
|
|
32
32
|
import './chunk-magic-string.efe26975.mjs';
|
|
33
33
|
import './vendor-index.98e769c1.mjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import {
|
|
3
|
-
import { d as environments, t as takeCoverage, p as pLimit, f as envs } from './chunk-env-node.
|
|
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 globalExpect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter,
|
|
2
|
+
import { v as isNode, a as getWorkerState, R as RealDate, h as safeClearTimeout, f as safeSetTimeout, F as toArray, Q as deepClone, O as getType, u as relative, S as partitionSuiteChildren, E as shuffle, T as hasTests, y as hasFailed, e as getFullName, k as resetModules } from './chunk-utils-global.4828c2e2.mjs';
|
|
3
|
+
import { d as environments, t as takeCoverage, p as pLimit, f as envs } from './chunk-env-node.aa51c4cc.mjs';
|
|
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 globalExpect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, G as GLOBAL_EXPECT, z as getFn, A as getState } from './chunk-runtime-chain.6d23d202.mjs';
|
|
5
5
|
import chai, { assert, should, util } from 'chai';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.d986adb9.mjs';
|
|
7
7
|
import { format } from 'util';
|
|
8
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
8
|
+
import { s as stringify } from './chunk-utils-source-map.a9047343.mjs';
|
|
9
9
|
|
|
10
10
|
var index = /*#__PURE__*/Object.freeze({
|
|
11
11
|
__proto__: null,
|
|
@@ -45,7 +45,7 @@ async function setupGlobalEnv(config) {
|
|
|
45
45
|
if (isNode)
|
|
46
46
|
await setupConsoleLogSpy();
|
|
47
47
|
if (config.globals)
|
|
48
|
-
(await import('./chunk-integrations-globals.
|
|
48
|
+
(await import('./chunk-integrations-globals.3df36e26.mjs')).registerApiGlobally();
|
|
49
49
|
}
|
|
50
50
|
function setupDefines(defines) {
|
|
51
51
|
for (const key in defines)
|
|
@@ -167,9 +167,9 @@ async function withEnv(name, options, fn) {
|
|
|
167
167
|
}
|
|
168
168
|
async function runSetupFiles(config) {
|
|
169
169
|
const files = toArray(config.setupFiles);
|
|
170
|
-
await Promise.all(files.map(async (
|
|
171
|
-
getWorkerState().moduleCache.delete(
|
|
172
|
-
await import(
|
|
170
|
+
await Promise.all(files.map(async (fsPath) => {
|
|
171
|
+
getWorkerState().moduleCache.delete(fsPath);
|
|
172
|
+
await import(fsPath);
|
|
173
173
|
}));
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -546,11 +546,18 @@ async function runSuite(suite) {
|
|
|
546
546
|
} else {
|
|
547
547
|
try {
|
|
548
548
|
const beforeAllCleanups = await callSuiteHook(suite, suite, "beforeAll", [suite]);
|
|
549
|
-
for (
|
|
549
|
+
for (let tasksGroup of partitionSuiteChildren(suite)) {
|
|
550
550
|
if (tasksGroup[0].concurrent === true) {
|
|
551
551
|
const mutex = pLimit(workerState.config.maxConcurrency);
|
|
552
552
|
await Promise.all(tasksGroup.map((c) => mutex(() => runSuiteChild(c))));
|
|
553
553
|
} else {
|
|
554
|
+
const { sequence } = workerState.config;
|
|
555
|
+
if (sequence.shuffle || suite.shuffle) {
|
|
556
|
+
const suites = tasksGroup.filter((group) => group.type === "suite");
|
|
557
|
+
const tests = tasksGroup.filter((group) => group.type === "test");
|
|
558
|
+
const groups = shuffle([suites, tests], sequence.seed);
|
|
559
|
+
tasksGroup = groups.flatMap((group) => shuffle(group, sequence.seed));
|
|
560
|
+
}
|
|
554
561
|
for (const c of tasksGroup)
|
|
555
562
|
await runSuiteChild(c);
|
|
556
563
|
}
|
|
File without changes
|
package/dist/worker.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.
|
|
1
|
+
import { q as resolve, a as getWorkerState } from './chunk-utils-global.4828c2e2.mjs';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.0f776286.mjs';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
|
-
import { d as distDir } from './chunk-constants.
|
|
5
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
4
|
+
import { d as distDir } from './chunk-constants.27550afb.mjs';
|
|
5
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.34b9d585.mjs';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.d986adb9.mjs';
|
|
7
7
|
import 'tty';
|
|
8
8
|
import 'local-pkg';
|
|
9
9
|
import 'path';
|
|
@@ -75,9 +75,9 @@ function init(ctx) {
|
|
|
75
75
|
})
|
|
76
76
|
};
|
|
77
77
|
if (ctx.invalidates) {
|
|
78
|
-
ctx.invalidates.forEach((
|
|
79
|
-
moduleCache.delete(
|
|
80
|
-
moduleCache.delete(`${
|
|
78
|
+
ctx.invalidates.forEach((fsPath) => {
|
|
79
|
+
moduleCache.delete(fsPath);
|
|
80
|
+
moduleCache.delete(`${fsPath}__mock`);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
ctx.files.forEach((i) => moduleCache.delete(i));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@types/natural-compare": "^1.4.1",
|
|
102
102
|
"@types/prompts": "^2.4.0",
|
|
103
103
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
104
|
-
"@vitest/ui": "0.17.
|
|
104
|
+
"@vitest/ui": "0.17.1",
|
|
105
105
|
"birpc": "^0.2.3",
|
|
106
106
|
"c8": "^7.11.3",
|
|
107
107
|
"cac": "^6.7.12",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"source-map-js": "^1.0.2",
|
|
130
130
|
"strip-ansi": "^7.0.1",
|
|
131
131
|
"typescript": "^4.7.4",
|
|
132
|
-
"vite-node": "0.17.
|
|
132
|
+
"vite-node": "0.17.1",
|
|
133
133
|
"ws": "^8.8.0"
|
|
134
134
|
},
|
|
135
135
|
"scripts": {
|