vitest 4.0.0-beta.10 → 4.0.0-beta.11
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/LICENSE.md +81 -0
- package/dist/browser.d.ts +9 -5
- package/dist/browser.js +8 -5
- package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.LXhJ0F0X.js} +2 -2
- package/dist/chunks/{browser.d.yFAklsD1.d.ts → browser.d.Dx7DO_Ce.d.ts} +1 -1
- package/dist/chunks/{cac.DCxo_nSu.js → cac.elvK37c9.js} +8 -8
- package/dist/chunks/{cli-api.BJJXh9BV.js → cli-api.C7plPyhs.js} +64 -34
- package/dist/chunks/{console.7h5kHUIf.js → console.CiTi59Jy.js} +2 -2
- package/dist/chunks/{coverage.BCU-r2QL.js → coverage.CG6Uhorw.js} +14 -18
- package/dist/chunks/{globals.DG-S3xFe.js → globals.BjvYA-AD.js} +7 -5
- package/dist/chunks/{index.CMfqw92x.js → index.AZOjjqWP.js} +2 -2
- package/dist/chunks/{index.BjKEiSn0.js → index.BhY64fF0.js} +3 -3
- package/dist/chunks/{index.BIP7prJq.js → index.BwBttQPf.js} +67 -71
- package/dist/chunks/{moduleRunner.d.D9nBoC4p.d.ts → moduleRunner.d.BNa-CL9e.d.ts} +1 -1
- package/dist/chunks/{node.CyipiPvJ.js → node.BsdMi6DV.js} +2 -2
- package/dist/chunks/{plugin.d.BMVSnsGV.d.ts → plugin.d.C5phQR6o.d.ts} +1 -1
- package/dist/chunks/{reporters.d.BUWjmRYq.d.ts → reporters.d.CVzhsTvK.d.ts} +16 -11
- package/dist/chunks/{resolveSnapshotEnvironment.Bkht6Yor.js → resolveSnapshotEnvironment.DQVamkje.js} +5 -5
- package/dist/chunks/{rpc.BKr6mtxz.js → rpc.jKGRSXIH.js} +2 -2
- package/dist/chunks/{setup-common.uiMcU3cv.js → setup-common.NAWRuMRP.js} +3 -3
- package/dist/chunks/{startModuleRunner.p67gbNo9.js → startModuleRunner.oAuCu1yL.js} +27 -10
- package/dist/chunks/{test.BiqSKISg.js → test.KC5tH8hC.js} +6 -6
- package/dist/chunks/{typechecker.DB-fIMaH.js → typechecker.gXq-5P3n.js} +640 -7
- package/dist/chunks/{utils.D2R2NiOH.js → utils.DGKhod2J.js} +1 -1
- package/dist/chunks/{vi.ZPgvtBao.js → vi.CiJ0Laa6.js} +4 -2
- package/dist/chunks/{worker.d.BDsXGkwh.d.ts → worker.d.B_Fd9M_w.d.ts} +1 -76
- package/dist/{worker.js → chunks/worker.rPGLlbkW.js} +65 -32
- package/dist/cli.js +7 -5
- package/dist/config.d.ts +5 -5
- package/dist/coverage.d.ts +3 -3
- package/dist/coverage.js +3 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -5
- package/dist/module-evaluator.d.ts +2 -2
- package/dist/module-evaluator.js +1 -1
- package/dist/module-runner.js +5 -5
- package/dist/node.d.ts +12 -9
- package/dist/node.js +16 -12
- package/dist/reporters.d.ts +3 -3
- package/dist/reporters.js +7 -5
- package/dist/runners.js +8 -6
- package/dist/snapshot.js +3 -3
- package/dist/suite.js +4 -3
- package/dist/{chunks/base.Cjha6usc.js → worker-base.js} +88 -14
- package/dist/{chunks/vm.Ca0Y0W5f.js → worker-vm.js} +69 -8
- package/dist/workers/runVmTests.js +12 -9
- package/package.json +20 -19
- package/browser.d.ts +0 -1
- package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
- package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
- package/dist/chunks/utils.C2YI6McM.js +0 -52
- package/dist/chunks/worker.d.BNcX_2mH.d.ts +0 -8
- package/dist/workers/forks.js +0 -67
- package/dist/workers/threads.js +0 -55
- package/dist/workers/vmForks.js +0 -48
- package/dist/workers/vmThreads.js +0 -38
- package/dist/workers.d.ts +0 -38
- package/dist/workers.js +0 -48
- package/execute.d.ts +0 -1
- package/utils.d.ts +0 -1
- package/workers.d.ts +0 -1
package/LICENSE.md
CHANGED
|
@@ -57,6 +57,87 @@ Repository: git+https://github.com/antfu/install-pkg.git
|
|
|
57
57
|
|
|
58
58
|
---------------------------------------
|
|
59
59
|
|
|
60
|
+
## @jridgewell/resolve-uri
|
|
61
|
+
License: MIT
|
|
62
|
+
By: Justin Ridgewell
|
|
63
|
+
Repository: https://github.com/jridgewell/resolve-uri
|
|
64
|
+
|
|
65
|
+
> Copyright 2019 Justin Ridgewell <jridgewell@google.com>
|
|
66
|
+
>
|
|
67
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
68
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
69
|
+
> in the Software without restriction, including without limitation the rights
|
|
70
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
71
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
72
|
+
> furnished to do so, subject to the following conditions:
|
|
73
|
+
>
|
|
74
|
+
> The above copyright notice and this permission notice shall be included in
|
|
75
|
+
> all copies or substantial portions of the Software.
|
|
76
|
+
>
|
|
77
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
78
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
79
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
80
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
81
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
82
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
83
|
+
> SOFTWARE.
|
|
84
|
+
|
|
85
|
+
---------------------------------------
|
|
86
|
+
|
|
87
|
+
## @jridgewell/sourcemap-codec
|
|
88
|
+
License: MIT
|
|
89
|
+
By: Justin Ridgewell
|
|
90
|
+
Repository: git+https://github.com/jridgewell/sourcemaps.git
|
|
91
|
+
|
|
92
|
+
> Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
|
|
93
|
+
>
|
|
94
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
95
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
96
|
+
> in the Software without restriction, including without limitation the rights
|
|
97
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
98
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
99
|
+
> furnished to do so, subject to the following conditions:
|
|
100
|
+
>
|
|
101
|
+
> The above copyright notice and this permission notice shall be included in
|
|
102
|
+
> all copies or substantial portions of the Software.
|
|
103
|
+
>
|
|
104
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
> SOFTWARE.
|
|
111
|
+
|
|
112
|
+
---------------------------------------
|
|
113
|
+
|
|
114
|
+
## @jridgewell/trace-mapping
|
|
115
|
+
License: MIT
|
|
116
|
+
By: Justin Ridgewell
|
|
117
|
+
Repository: git+https://github.com/jridgewell/sourcemaps.git
|
|
118
|
+
|
|
119
|
+
> Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
|
|
120
|
+
>
|
|
121
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
122
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
123
|
+
> in the Software without restriction, including without limitation the rights
|
|
124
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
125
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
126
|
+
> furnished to do so, subject to the following conditions:
|
|
127
|
+
>
|
|
128
|
+
> The above copyright notice and this permission notice shall be included in
|
|
129
|
+
> all copies or substantial portions of the Software.
|
|
130
|
+
>
|
|
131
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
132
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
133
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
134
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
135
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
136
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
137
|
+
> SOFTWARE.
|
|
138
|
+
|
|
139
|
+
---------------------------------------
|
|
140
|
+
|
|
60
141
|
## @sinonjs/commons
|
|
61
142
|
License: BSD-3-Clause
|
|
62
143
|
Repository: git+https://github.com/sinonjs/commons.git
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { S as SerializedCoverageConfig, a as SerializedConfig } from './chunks/config.d.B_LthbQq.js';
|
|
2
2
|
import { R as RuntimeCoverageModuleLoader } from './chunks/coverage.d.BZtK59WP.js';
|
|
3
3
|
import { SerializedDiffOptions } from '@vitest/utils/diff';
|
|
4
|
-
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.
|
|
5
|
-
export { collectTests,
|
|
4
|
+
import { V as VitestModuleRunner } from './chunks/moduleRunner.d.BNa-CL9e.js';
|
|
5
|
+
export { collectTests, startTests } from '@vitest/runner';
|
|
6
6
|
import * as _vitest_spy from '@vitest/spy';
|
|
7
7
|
export { _vitest_spy as SpyModule };
|
|
8
|
-
export { LoupeOptions, ParsedStack, StringifyOptions
|
|
9
|
-
export {
|
|
8
|
+
export { LoupeOptions, ParsedStack, StringifyOptions } from '@vitest/utils';
|
|
9
|
+
export { format, inspect, stringify } from '@vitest/utils/display';
|
|
10
|
+
export { processError } from '@vitest/utils/error';
|
|
11
|
+
export { getType } from '@vitest/utils/helpers';
|
|
12
|
+
export { DecodedMap, getOriginalPosition } from '@vitest/utils/source-map';
|
|
13
|
+
export { getSafeTimers, setSafeTimers } from '@vitest/utils/timers';
|
|
10
14
|
import '@vitest/pretty-format';
|
|
11
15
|
import '@vitest/snapshot';
|
|
12
16
|
import 'node:vm';
|
|
13
17
|
import 'vite/module-runner';
|
|
14
|
-
import './chunks/worker.d.
|
|
18
|
+
import './chunks/worker.d.B_Fd9M_w.js';
|
|
15
19
|
import './chunks/environment.d.BsToaxti.js';
|
|
16
20
|
import '@vitest/mocker';
|
|
17
21
|
import './chunks/mocker.d.BE_2ls6u.js';
|
package/dist/browser.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.
|
|
2
|
-
export { collectTests,
|
|
1
|
+
export { l as loadDiffConfig, b as loadSnapshotSerializers, c as setupCommonEnv, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/setup-common.NAWRuMRP.js';
|
|
2
|
+
export { collectTests, startTests } from '@vitest/runner';
|
|
3
3
|
import * as spyModule from '@vitest/spy';
|
|
4
4
|
export { spyModule as SpyModule };
|
|
5
|
-
export { format,
|
|
6
|
-
export {
|
|
5
|
+
export { format, inspect, stringify } from '@vitest/utils/display';
|
|
6
|
+
export { processError } from '@vitest/utils/error';
|
|
7
|
+
export { getType } from '@vitest/utils/helpers';
|
|
8
|
+
export { DecodedMap, getOriginalPosition } from '@vitest/utils/source-map';
|
|
9
|
+
export { getSafeTimers, setSafeTimers } from '@vitest/utils/timers';
|
|
7
10
|
import './chunks/coverage.D_JHT54q.js';
|
|
8
11
|
import '@vitest/snapshot';
|
|
9
|
-
import './chunks/utils.
|
|
12
|
+
import './chunks/utils.DGKhod2J.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
import { noop } from '@vitest/utils';
|
|
4
|
-
import { g as getWorkerState } from './utils.
|
|
3
|
+
import { noop } from '@vitest/utils/helpers';
|
|
4
|
+
import { g as getWorkerState } from './utils.DGKhod2J.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap(), benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getBenchOptions(key) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { toArray } from '@vitest/utils';
|
|
1
|
+
import { toArray } from '@vitest/utils/helpers';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { normalize } from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
5
|
import { a as defaultPort, d as defaultBrowserPort } from './constants.D_Q9UYh-.js';
|
|
6
|
-
import { R as ReportersMap } from './index.
|
|
6
|
+
import { R as ReportersMap } from './index.BwBttQPf.js';
|
|
7
7
|
|
|
8
8
|
function toArr(any) {
|
|
9
9
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -619,7 +619,7 @@ class CAC extends EventEmitter {
|
|
|
619
619
|
|
|
620
620
|
const cac = (name = "") => new CAC(name);
|
|
621
621
|
|
|
622
|
-
var version = "4.0.0-beta.
|
|
622
|
+
var version = "4.0.0-beta.11";
|
|
623
623
|
|
|
624
624
|
const apiConfig = (port) => ({
|
|
625
625
|
port: {
|
|
@@ -1293,7 +1293,7 @@ function createCLI(options = {}) {
|
|
|
1293
1293
|
}), cli.command("run [...filters]", void 0, options).action(run), cli.command("related [...filters]", void 0, options).action(runRelated), cli.command("watch [...filters]", void 0, options).action(watch), cli.command("dev [...filters]", void 0, options).action(watch), addCliOptions(cli.command("bench [...filters]", void 0, options).action(benchmark), benchCliOptionsConfig), cli.command("init <project>", void 0, options).action(init), addCliOptions(cli.command("list [...filters]", void 0, options).action((filters, options) => collect("test", filters, options)), collectCliOptionsConfig), cli.command("[...filters]", void 0, options).action((filters, options) => start("test", filters, options)), cli;
|
|
1294
1294
|
}
|
|
1295
1295
|
function removeQuotes(str) {
|
|
1296
|
-
return typeof str === "string" ? str
|
|
1296
|
+
return typeof str === "string" ? str[0] === "\"" && str.endsWith("\"") || str.startsWith(`'`) && str.endsWith(`'`) ? str.slice(1, -1) : str : Array.isArray(str) ? str.map(removeQuotes) : str;
|
|
1297
1297
|
}
|
|
1298
1298
|
function splitArgv(argv) {
|
|
1299
1299
|
const reg = /(['"])(?:(?!\1).)+\1/g;
|
|
@@ -1334,10 +1334,10 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
async function start(mode, cliFilters, options) {
|
|
1336
1336
|
try {
|
|
1337
|
-
const { startVitest } = await import('./cli-api.
|
|
1337
|
+
const { startVitest } = await import('./cli-api.C7plPyhs.js').then(function (n) { return n.j; }), ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
1338
1338
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
1339
1339
|
} catch (e) {
|
|
1340
|
-
const { errorBanner } = await import('./index.
|
|
1340
|
+
const { errorBanner } = await import('./index.BwBttQPf.js').then(function (n) { return n.u; });
|
|
1341
1341
|
if (console.error(`\n${errorBanner("Startup Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1342
1342
|
process.exit();
|
|
1343
1343
|
}
|
|
@@ -1349,7 +1349,7 @@ async function init(project) {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
async function collect(mode, cliFilters, options) {
|
|
1351
1351
|
try {
|
|
1352
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
1352
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.C7plPyhs.js').then(function (n) { return n.j; }), ctx = await prepareVitest(mode, {
|
|
1353
1353
|
...normalizeCliOptions(cliFilters, options),
|
|
1354
1354
|
watch: false,
|
|
1355
1355
|
run: true
|
|
@@ -1367,7 +1367,7 @@ async function collect(mode, cliFilters, options) {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
await ctx.close();
|
|
1369
1369
|
} catch (e) {
|
|
1370
|
-
const { errorBanner } = await import('./index.
|
|
1370
|
+
const { errorBanner } = await import('./index.BwBttQPf.js').then(function (n) { return n.u; });
|
|
1371
1371
|
if (console.error(`\n${errorBanner("Collect Error")}`), console.error(e), console.error("\n\n"), process.exitCode == null) process.exitCode = 1;
|
|
1372
1372
|
process.exit();
|
|
1373
1373
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import fs, { promises, existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import fs, { promises, existsSync, readFileSync, statSync, readdirSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { relative, resolve, dirname, extname, normalize, join, basename, isAbsolute } from 'pathe';
|
|
3
3
|
import { C as CoverageProviderMap } from './coverage.D_JHT54q.js';
|
|
4
4
|
import path, { resolve as resolve$1 } from 'node:path';
|
|
5
|
-
import { noop, createDefer, slash,
|
|
5
|
+
import { noop, createDefer, slash, toArray, cleanUrl, deepMerge, nanoid, deepClone, isPrimitive, notNullish } from '@vitest/utils/helpers';
|
|
6
6
|
import { f as findUp, p as prompt } from './index.X0nbfr6-.js';
|
|
7
7
|
import * as vite from 'vite';
|
|
8
8
|
import { parseAst, searchForWorkspaceRoot, version, mergeConfig, createServer } from 'vite';
|
|
9
9
|
import { A as API_PATH, c as configFiles, d as defaultBrowserPort, a as defaultPort } from './constants.D_Q9UYh-.js';
|
|
10
10
|
import nodeos__default, { tmpdir } from 'node:os';
|
|
11
|
-
import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, hasFailed, getTasks,
|
|
11
|
+
import { generateHash as generateHash$1, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, generateFileHash, limitConcurrency, createFileTask as createFileTask$1, hasFailed, getTasks, isTestCase } from '@vitest/runner/utils';
|
|
12
12
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
13
|
-
import { v as version$1 } from './cac.
|
|
13
|
+
import { v as version$1 } from './cac.elvK37c9.js';
|
|
14
14
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
15
|
-
import { p as parse,
|
|
15
|
+
import { p as parse, d as stringify, e as printError, f as formatProjectName, w as withLabel, h as errorBanner, i as divider, j as generateCodeFrame, R as ReportersMap, B as BlobReporter, r as readBlobs, H as HangingProcessReporter } from './index.BwBttQPf.js';
|
|
16
16
|
import require$$0$3 from 'events';
|
|
17
17
|
import require$$1$1 from 'https';
|
|
18
18
|
import require$$2 from 'http';
|
|
@@ -26,14 +26,14 @@ import require$$0$1 from 'buffer';
|
|
|
26
26
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
27
27
|
import crypto, { createHash } from 'node:crypto';
|
|
28
28
|
import { distDir, rootDir } from '../path.js';
|
|
29
|
-
import { h as hash, d as createFetchModuleFunction, n as normalizeResolvedIdToUrl, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, e as isBrowserEnabled, r as resolveConfig, f as groupBy, j as getCoverageProvider, k as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.
|
|
30
|
-
import { b as
|
|
31
|
-
import { TraceMap, originalPositionFor, parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
29
|
+
import { h as hash, d as createFetchModuleFunction, n as normalizeResolvedIdToUrl, R as RandomSequencer, i as isPackageExists, g as getFilePoolName, e as isBrowserEnabled, r as resolveConfig, f as groupBy, j as getCoverageProvider, k as createPool, w as wildcardPatternToRegExp, a as resolveApiServerConfig, s as stdout } from './coverage.CG6Uhorw.js';
|
|
30
|
+
import { b as TraceMap, o as originalPositionFor, c as ancestor, d as createDefinesScript, e as convertTasksToEvents } from './typechecker.gXq-5P3n.js';
|
|
32
31
|
import createDebug from 'debug';
|
|
33
32
|
import { VitestModuleEvaluator } from '#module-evaluator';
|
|
34
33
|
import { ModuleRunner } from 'vite/module-runner';
|
|
35
34
|
import { Console } from 'node:console';
|
|
36
35
|
import c from 'tinyrainbow';
|
|
36
|
+
import { highlight } from '@vitest/utils/highlight';
|
|
37
37
|
import { createRequire, builtinModules, isBuiltin } from 'node:module';
|
|
38
38
|
import url, { pathToFileURL } from 'node:url';
|
|
39
39
|
import { i as isTTY, a as isWindows } from './env.D4Lgay0q.js';
|
|
@@ -43,11 +43,13 @@ import { glob, isDynamicPattern } from 'tinyglobby';
|
|
|
43
43
|
import MagicString from 'magic-string';
|
|
44
44
|
import { hoistMocksPlugin, automockPlugin } from '@vitest/mocker/node';
|
|
45
45
|
import { c as configDefaults } from './defaults.CXFFjsi8.js';
|
|
46
|
-
import {
|
|
46
|
+
import { KNOWN_ASSET_RE } from '@vitest/utils/constants';
|
|
47
|
+
import { findNearestPackageData } from '@vitest/utils/resolver';
|
|
47
48
|
import * as esModuleLexer from 'es-module-lexer';
|
|
48
|
-
import { a as BenchmarkReportsMap } from './index.
|
|
49
|
+
import { a as BenchmarkReportsMap } from './index.BhY64fF0.js';
|
|
49
50
|
import assert$1 from 'node:assert';
|
|
50
|
-
import {
|
|
51
|
+
import { serializeValue } from '@vitest/utils/serialize';
|
|
52
|
+
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
51
53
|
import readline from 'node:readline';
|
|
52
54
|
import { stripVTControlCharacters } from 'node:util';
|
|
53
55
|
|
|
@@ -5616,7 +5618,6 @@ class ServerModuleRunner extends ModuleRunner {
|
|
|
5616
5618
|
const fetchModule = createFetchModuleFunction(resolver, false);
|
|
5617
5619
|
super({
|
|
5618
5620
|
hmr: false,
|
|
5619
|
-
sourcemapInterceptor: "node",
|
|
5620
5621
|
transport: { async invoke(event) {
|
|
5621
5622
|
if (event.type !== "custom") throw new Error(`Vitest Module Runner doesn't support Vite HMR events.`);
|
|
5622
5623
|
const { data } = event.data;
|
|
@@ -7415,6 +7416,8 @@ class TestProject {
|
|
|
7415
7416
|
this.browser?.close(),
|
|
7416
7417
|
this.clearTmpDir()
|
|
7417
7418
|
].filter(Boolean)).then(() => {
|
|
7419
|
+
if (!this.runner.isClosed()) return this.runner.close();
|
|
7420
|
+
}).then(() => {
|
|
7418
7421
|
this._provided = {}, this._vite = void 0;
|
|
7419
7422
|
});
|
|
7420
7423
|
return this.closingPromise;
|
|
@@ -7511,6 +7514,11 @@ function generateHash(str) {
|
|
|
7511
7514
|
return `${hash}`;
|
|
7512
7515
|
}
|
|
7513
7516
|
|
|
7517
|
+
// vitest.config.*
|
|
7518
|
+
// vite.config.*
|
|
7519
|
+
// vitest.unit.config.*
|
|
7520
|
+
// vite.unit.config.*
|
|
7521
|
+
const CONFIG_REGEXP = /^vite(?:st)?(?:\.\w+)?\.config\./;
|
|
7514
7522
|
async function resolveProjects(vitest, cliOptions, workspaceConfigPath, projectsDefinition, names) {
|
|
7515
7523
|
const { configFiles, projectConfigs, nonConfigDirectories } = await resolveTestProjectConfigs(vitest, workspaceConfigPath, projectsDefinition), overridesOptions = [
|
|
7516
7524
|
"logHeapUsage",
|
|
@@ -7695,11 +7703,14 @@ async function resolveTestProjectConfigs(vitest, workspaceConfigPath, projectsDe
|
|
|
7695
7703
|
const note = "Projects definition";
|
|
7696
7704
|
throw new Error(`${note} references a non-existing file or a directory: ${file}`);
|
|
7697
7705
|
}
|
|
7698
|
-
const stats =
|
|
7706
|
+
const stats = statSync(file);
|
|
7699
7707
|
// user can specify a config file directly
|
|
7700
|
-
if (stats.isFile())
|
|
7701
|
-
|
|
7702
|
-
|
|
7708
|
+
if (stats.isFile()) {
|
|
7709
|
+
const name = basename(file);
|
|
7710
|
+
if (!CONFIG_REGEXP.test(name)) throw new Error(`The file "${relative(vitest.config.root, file)}" must start with "vitest.config"/"vite.config" or match the pattern "(vitest|vite).*.config.*" to be a valid project config.`);
|
|
7711
|
+
projectsConfigFiles.push(file);
|
|
7712
|
+
} else if (stats.isDirectory()) {
|
|
7713
|
+
const configFile = resolveDirectoryConfig(file);
|
|
7703
7714
|
if (configFile) projectsConfigFiles.push(configFile);
|
|
7704
7715
|
else {
|
|
7705
7716
|
const directory = file.at(-1) === "/" ? file : `${file}/`;
|
|
@@ -7729,15 +7740,19 @@ async function resolveTestProjectConfigs(vitest, workspaceConfigPath, projectsDe
|
|
|
7729
7740
|
"**/.DS_Store"
|
|
7730
7741
|
]
|
|
7731
7742
|
}, projectsFs = await glob(projectsGlobMatches, globOptions);
|
|
7732
|
-
|
|
7743
|
+
projectsFs.forEach((path) => {
|
|
7733
7744
|
// directories are allowed with a glob like `packages/*`
|
|
7734
7745
|
// in this case every directory is treated as a project
|
|
7735
7746
|
if (path.endsWith("/")) {
|
|
7736
|
-
const configFile =
|
|
7747
|
+
const configFile = resolveDirectoryConfig(path);
|
|
7737
7748
|
if (configFile) projectsConfigFiles.push(configFile);
|
|
7738
7749
|
else nonConfigProjectDirectories.push(path);
|
|
7739
|
-
} else
|
|
7740
|
-
|
|
7750
|
+
} else {
|
|
7751
|
+
const name = basename(path);
|
|
7752
|
+
if (!CONFIG_REGEXP.test(name)) throw new Error(`The projects glob matched a file "${relative(vitest.config.root, path)}", but it should also either start with "vitest.config"/"vite.config" or match the pattern "(vitest|vite).*.config.*".`);
|
|
7753
|
+
projectsConfigFiles.push(path);
|
|
7754
|
+
}
|
|
7755
|
+
});
|
|
7741
7756
|
}
|
|
7742
7757
|
const projectConfigFiles = Array.from(new Set(projectsConfigFiles));
|
|
7743
7758
|
return {
|
|
@@ -7746,8 +7761,8 @@ async function resolveTestProjectConfigs(vitest, workspaceConfigPath, projectsDe
|
|
|
7746
7761
|
configFiles: projectConfigFiles
|
|
7747
7762
|
};
|
|
7748
7763
|
}
|
|
7749
|
-
|
|
7750
|
-
const files = new Set(
|
|
7764
|
+
function resolveDirectoryConfig(directory) {
|
|
7765
|
+
const files = new Set(readdirSync(directory)), configFile = configFiles.find((file) => files.has(file));
|
|
7751
7766
|
return configFile ? resolve(directory, configFile) : null;
|
|
7752
7767
|
}
|
|
7753
7768
|
function getDefaultTestProject(vitest) {
|
|
@@ -8866,7 +8881,7 @@ class TestRun {
|
|
|
8866
8881
|
async updated(update, events) {
|
|
8867
8882
|
this.syncUpdateStacks(update), this.vitest.state.updateTasks(update);
|
|
8868
8883
|
for (const [id, event, data] of events) await this.reportEvent(id, event, data).catch((error) => {
|
|
8869
|
-
this.vitest.state.catchError(
|
|
8884
|
+
this.vitest.state.catchError(serializeValue(error), "Unhandled Reporter Error");
|
|
8870
8885
|
});
|
|
8871
8886
|
// TODO: what is the order or reports here?
|
|
8872
8887
|
// "onTaskUpdate" in parallel with others or before all or after all?
|
|
@@ -9981,9 +9996,11 @@ class WatchFilter {
|
|
|
9981
9996
|
this.write(`${ESC}1G${ESC}0J`), onSubmit(void 0);
|
|
9982
9997
|
return;
|
|
9983
9998
|
case key?.name === "enter":
|
|
9984
|
-
case key?.name === "return":
|
|
9985
|
-
|
|
9999
|
+
case key?.name === "return": {
|
|
10000
|
+
const selection = this.results[this.selectionIndex], result = typeof selection === "string" ? selection : selection?.key;
|
|
10001
|
+
onSubmit(result || this.currentKeyword || ""), this.currentKeyword = void 0;
|
|
9986
10002
|
break;
|
|
10003
|
+
}
|
|
9987
10004
|
case key?.name === "up":
|
|
9988
10005
|
if (this.selectionIndex && this.selectionIndex > 0) this.selectionIndex--;
|
|
9989
10006
|
else this.selectionIndex = -1;
|
|
@@ -10045,7 +10062,7 @@ ${c.dim(` ...and ${remainingResultCount} more ${remainingResultCount === 1 ? "
|
|
|
10045
10062
|
this.stdout.write(data);
|
|
10046
10063
|
}
|
|
10047
10064
|
getLastResults() {
|
|
10048
|
-
return this.results;
|
|
10065
|
+
return this.results.map((r) => typeof r === "string" ? r : r.toString());
|
|
10049
10066
|
}
|
|
10050
10067
|
}
|
|
10051
10068
|
|
|
@@ -10071,6 +10088,26 @@ ${c.bold(" Watch Usage")}
|
|
|
10071
10088
|
${keys.map((i) => c.dim(" press ") + c.reset([i[0]].flat().map(c.bold).join(", ")) + c.dim(` to ${i[1]}`)).join("\n")}
|
|
10072
10089
|
`);
|
|
10073
10090
|
}
|
|
10091
|
+
function* traverseFilteredTestNames(parentName, filter, t) {
|
|
10092
|
+
if (isTestCase(t)) {
|
|
10093
|
+
if (t.name.match(filter)) {
|
|
10094
|
+
const displayName = `${parentName} > ${t.name}`;
|
|
10095
|
+
yield {
|
|
10096
|
+
key: t.name,
|
|
10097
|
+
toString: () => displayName
|
|
10098
|
+
};
|
|
10099
|
+
}
|
|
10100
|
+
} else {
|
|
10101
|
+
parentName = parentName.length ? `${parentName} > ${t.name}` : t.name;
|
|
10102
|
+
for (const task of t.tasks) yield* traverseFilteredTestNames(parentName, filter, task);
|
|
10103
|
+
}
|
|
10104
|
+
}
|
|
10105
|
+
function* getFilteredTestNames(pattern, suite) {
|
|
10106
|
+
try {
|
|
10107
|
+
const reg = new RegExp(pattern), files = /* @__PURE__ */ new Set();
|
|
10108
|
+
for (const file of suite) if (!files.has(file.name)) files.add(file.name), yield* traverseFilteredTestNames("", reg, file);
|
|
10109
|
+
} catch {}
|
|
10110
|
+
}
|
|
10074
10111
|
function registerConsoleShortcuts(ctx, stdin = process.stdin, stdout) {
|
|
10075
10112
|
let latestFilename = "";
|
|
10076
10113
|
async function _keypressHandler(str, key) {
|
|
@@ -10121,14 +10158,7 @@ function registerConsoleShortcuts(ctx, stdin = process.stdin, stdout) {
|
|
|
10121
10158
|
async function inputNamePattern() {
|
|
10122
10159
|
off();
|
|
10123
10160
|
const watchFilter = new WatchFilter("Input test name pattern (RegExp)", stdin, stdout), filter = await watchFilter.filter((str) => {
|
|
10124
|
-
|
|
10125
|
-
try {
|
|
10126
|
-
const reg = new RegExp(str);
|
|
10127
|
-
return tests.map((test) => test.name).filter((testName) => testName.match(reg));
|
|
10128
|
-
} catch {
|
|
10129
|
-
// `new RegExp` may throw error when input is invalid regexp
|
|
10130
|
-
return [];
|
|
10131
|
-
}
|
|
10161
|
+
return [...getFilteredTestNames(str, ctx.state.getFiles())];
|
|
10132
10162
|
});
|
|
10133
10163
|
if (on(), typeof filter === "undefined") return;
|
|
10134
10164
|
const files = ctx.state.getFilepaths(), cliFiles = ctx.config.standalone && !files.length ? await ctx._globTestFilepaths() : void 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Console } from 'node:console';
|
|
2
2
|
import { relative } from 'node:path';
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
|
-
import { getSafeTimers } from '@vitest/utils';
|
|
4
|
+
import { getSafeTimers } from '@vitest/utils/timers';
|
|
5
5
|
import c from 'tinyrainbow';
|
|
6
6
|
import { R as RealDate } from './date.-jtEtIeV.js';
|
|
7
|
-
import { g as getWorkerState } from './utils.
|
|
7
|
+
import { g as getWorkerState } from './utils.DGKhod2J.js';
|
|
8
8
|
|
|
9
9
|
const UNKNOWN_TEST_ID = "__vitest__unknown_test__";
|
|
10
10
|
function getTaskIdByStack(root) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs, { statSync, realpathSync, promises as promises$1, mkdirSync, existsSync, readdirSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import path, { win32, dirname, join, resolve } from 'node:path';
|
|
3
|
-
import { isExternalUrl, unwrapId, nanoid, withTrailingSlash as withTrailingSlash$1, cleanUrl, wrapId, createDefer, slash, shuffle, toArray } from '@vitest/utils';
|
|
3
|
+
import { isExternalUrl, unwrapId, nanoid, withTrailingSlash as withTrailingSlash$1, cleanUrl, wrapId, createDefer, slash, shuffle, toArray } from '@vitest/utils/helpers';
|
|
4
4
|
import { isAbsolute, join as join$1, dirname as dirname$1, resolve as resolve$1, relative, normalize } from 'pathe';
|
|
5
5
|
import pm from 'picomatch';
|
|
6
6
|
import { glob } from 'tinyglobby';
|
|
@@ -23,7 +23,7 @@ import { isatty } from 'node:tty';
|
|
|
23
23
|
import EventEmitter from 'node:events';
|
|
24
24
|
import { c as createBirpc } from './index.Bgo3tNWt.js';
|
|
25
25
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
26
|
-
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.
|
|
26
|
+
import { w as wrapSerializableConfig, a as Typechecker } from './typechecker.gXq-5P3n.js';
|
|
27
27
|
import { MessageChannel } from 'node:worker_threads';
|
|
28
28
|
import { hasFailed } from '@vitest/runner/utils';
|
|
29
29
|
import { rootDir } from '../path.js';
|
|
@@ -46,7 +46,7 @@ function escapeRegExp(s) {
|
|
|
46
46
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47
47
|
}
|
|
48
48
|
function wildcardPatternToRegExp(pattern) {
|
|
49
|
-
const negated = pattern
|
|
49
|
+
const negated = pattern[0] === "!";
|
|
50
50
|
if (negated) pattern = pattern.slice(1);
|
|
51
51
|
let regexp = `${pattern.split("*").map(escapeRegExp).join(".*")}$`;
|
|
52
52
|
if (negated) regexp = `(?!${regexp})`;
|
|
@@ -2497,7 +2497,7 @@ function inlineSourceMap(result) {
|
|
|
2497
2497
|
const sourceMap = { ...map };
|
|
2498
2498
|
// If the first line is not present on source maps, add simple 1:1 mapping ([0,0,0,0], [1,0,0,0])
|
|
2499
2499
|
// so that debuggers can be set to break on first line
|
|
2500
|
-
if (sourceMap.mappings
|
|
2500
|
+
if (sourceMap.mappings[0] === ";") sourceMap.mappings = `AAAA,CAAA${sourceMap.mappings}`;
|
|
2501
2501
|
return result.code = `${code.trimEnd()}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`, result;
|
|
2502
2502
|
}
|
|
2503
2503
|
function genSourceMapUrl(map) {
|
|
@@ -2686,9 +2686,9 @@ function createChildProcessChannel$1(project, collect = false) {
|
|
|
2686
2686
|
return channel;
|
|
2687
2687
|
}
|
|
2688
2688
|
function createForksPool(vitest, { execArgv, env }, specifications) {
|
|
2689
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.forks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0,
|
|
2689
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.forks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, options = {
|
|
2690
2690
|
runtime: "child_process",
|
|
2691
|
-
filename: resolve(vitest.distPath, "worker.js"),
|
|
2691
|
+
filename: resolve(vitest.distPath, "worker-base.js"),
|
|
2692
2692
|
teardown: "teardown",
|
|
2693
2693
|
maxThreads,
|
|
2694
2694
|
minThreads,
|
|
@@ -2706,7 +2706,6 @@ function createForksPool(vitest, { execArgv, env }, specifications) {
|
|
|
2706
2706
|
vitest.state.clearFiles(project, paths);
|
|
2707
2707
|
const channel = createChildProcessChannel$1(project, name === "collect"), workerId = ++id, data = {
|
|
2708
2708
|
pool: "forks",
|
|
2709
|
-
worker,
|
|
2710
2709
|
config,
|
|
2711
2710
|
files,
|
|
2712
2711
|
invalidates,
|
|
@@ -2793,8 +2792,8 @@ function createWorkerChannel$1(project, collect) {
|
|
|
2793
2792
|
};
|
|
2794
2793
|
}
|
|
2795
2794
|
function createThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
2796
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.threads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0,
|
|
2797
|
-
filename: resolve(vitest.distPath, "worker.js"),
|
|
2795
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.threads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, options = {
|
|
2796
|
+
filename: resolve(vitest.distPath, "worker-base.js"),
|
|
2798
2797
|
teardown: "teardown",
|
|
2799
2798
|
useAtomics: poolOptions.useAtomics ?? false,
|
|
2800
2799
|
maxThreads,
|
|
@@ -2813,7 +2812,6 @@ function createThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
|
2813
2812
|
vitest.state.clearFiles(project, paths);
|
|
2814
2813
|
const { workerPort, onClose } = createWorkerChannel$1(project, name === "collect"), workerId = ++id, data = {
|
|
2815
2814
|
pool: "threads",
|
|
2816
|
-
worker,
|
|
2817
2815
|
port: workerPort,
|
|
2818
2816
|
config,
|
|
2819
2817
|
files,
|
|
@@ -3052,9 +3050,9 @@ function createChildProcessChannel(project, collect) {
|
|
|
3052
3050
|
return { channel };
|
|
3053
3051
|
}
|
|
3054
3052
|
function createVmForksPool(vitest, { execArgv, env }, specifications) {
|
|
3055
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.vmForks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0,
|
|
3053
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.vmForks ?? {}, maxThreads = poolOptions.maxForks ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, options = {
|
|
3056
3054
|
runtime: "child_process",
|
|
3057
|
-
filename: resolve(vitest.distPath, "worker.js"),
|
|
3055
|
+
filename: resolve(vitest.distPath, "worker-vm.js"),
|
|
3058
3056
|
maxThreads,
|
|
3059
3057
|
minThreads,
|
|
3060
3058
|
env,
|
|
@@ -3077,8 +3075,7 @@ function createVmForksPool(vitest, { execArgv, env }, specifications) {
|
|
|
3077
3075
|
const paths = files.map((f) => f.filepath);
|
|
3078
3076
|
vitest.state.clearFiles(project, paths);
|
|
3079
3077
|
const { channel } = createChildProcessChannel(project, name === "collect"), workerId = ++id, data = {
|
|
3080
|
-
pool: "
|
|
3081
|
-
worker,
|
|
3078
|
+
pool: "vmForks",
|
|
3082
3079
|
config,
|
|
3083
3080
|
files,
|
|
3084
3081
|
invalidates,
|
|
@@ -3147,8 +3144,8 @@ function createWorkerChannel(project, collect) {
|
|
|
3147
3144
|
};
|
|
3148
3145
|
}
|
|
3149
3146
|
function createVmThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
3150
|
-
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.vmThreads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0,
|
|
3151
|
-
filename: resolve(vitest.distPath, "worker.js"),
|
|
3147
|
+
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length, threadsCount = vitest.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1), recommendedCount = vitest.config.watch ? threadsCount : Math.min(threadsCount, specifications.length), poolOptions = vitest.config.poolOptions?.vmThreads ?? {}, maxThreads = poolOptions.maxThreads ?? vitest.config.maxWorkers ?? recommendedCount, minThreads = vitest.config.watch ? Math.min(recommendedCount, maxThreads) : 0, options = {
|
|
3148
|
+
filename: resolve(vitest.distPath, "worker-vm.js"),
|
|
3152
3149
|
useAtomics: poolOptions.useAtomics ?? false,
|
|
3153
3150
|
maxThreads,
|
|
3154
3151
|
minThreads,
|
|
@@ -3173,7 +3170,6 @@ function createVmThreadsPool(vitest, { execArgv, env }, specifications) {
|
|
|
3173
3170
|
vitest.state.clearFiles(project, paths);
|
|
3174
3171
|
const { workerPort, onClose } = createWorkerChannel(project, name === "collect"), workerId = ++id, data = {
|
|
3175
3172
|
pool: "vmThreads",
|
|
3176
|
-
worker,
|
|
3177
3173
|
port: workerPort,
|
|
3178
3174
|
config,
|
|
3179
3175
|
files: paths,
|
|
@@ -3532,7 +3528,7 @@ function resolveConfig$1(vitest, options, viteConfig) {
|
|
|
3532
3528
|
const envModuleDirectories = process.env.VITEST_MODULE_DIRECTORIES || process.env.npm_config_VITEST_MODULE_DIRECTORIES;
|
|
3533
3529
|
if (envModuleDirectories) resolved.deps.moduleDirectories.push(...envModuleDirectories.split(","));
|
|
3534
3530
|
if (resolved.deps.moduleDirectories = resolved.deps.moduleDirectories.map((dir) => {
|
|
3535
|
-
if (
|
|
3531
|
+
if (dir[0] !== "/") dir = `/${dir}`;
|
|
3536
3532
|
if (!dir.endsWith("/")) dir += "/";
|
|
3537
3533
|
return normalize(dir);
|
|
3538
3534
|
}), !resolved.deps.moduleDirectories.includes("/node_modules/")) resolved.deps.moduleDirectories.push("/node_modules/");
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { g as globalApis } from './constants.D_Q9UYh-.js';
|
|
2
|
-
import { i as index } from './index.
|
|
3
|
-
import './vi.
|
|
2
|
+
import { i as index } from './index.AZOjjqWP.js';
|
|
3
|
+
import './vi.CiJ0Laa6.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/runner/utils';
|
|
7
|
-
import './utils.
|
|
8
|
-
import '@vitest/utils';
|
|
7
|
+
import './utils.DGKhod2J.js';
|
|
8
|
+
import '@vitest/utils/timers';
|
|
9
9
|
import './_commonjsHelpers.BFTU3MAI.js';
|
|
10
10
|
import '@vitest/snapshot';
|
|
11
11
|
import '@vitest/utils/error';
|
|
12
|
+
import '@vitest/utils/helpers';
|
|
12
13
|
import '@vitest/spy';
|
|
14
|
+
import '@vitest/utils/offset';
|
|
13
15
|
import '@vitest/utils/source-map';
|
|
14
16
|
import './date.-jtEtIeV.js';
|
|
15
|
-
import './benchmark.
|
|
17
|
+
import './benchmark.LXhJ0F0X.js';
|
|
16
18
|
import 'expect-type';
|
|
17
19
|
import 'vite/module-runner';
|
|
18
20
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as assert, c as createExpect, g as globalExpect, i as inject, s as should, v as vi, d as vitest } from './vi.
|
|
2
|
-
import { b as bench } from './benchmark.
|
|
1
|
+
import { b as assert, c as createExpect, g as globalExpect, i as inject, s as should, v as vi, d as vitest } from './vi.CiJ0Laa6.js';
|
|
2
|
+
import { b as bench } from './benchmark.LXhJ0F0X.js';
|
|
3
3
|
import { expectTypeOf } from 'expect-type';
|
|
4
4
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
5
5
|
import { EvaluatedModules } from 'vite/module-runner';
|
|
@@ -2,9 +2,9 @@ import fs from 'node:fs';
|
|
|
2
2
|
import { getTasks, getFullName, getTests } from '@vitest/runner/utils';
|
|
3
3
|
import * as pathe from 'pathe';
|
|
4
4
|
import c from 'tinyrainbow';
|
|
5
|
-
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName } from './index.
|
|
5
|
+
import { g as getStateSymbol, t as truncateString, F as F_RIGHT, D as DefaultReporter, f as formatProjectName, s as separator } from './index.BwBttQPf.js';
|
|
6
6
|
import { stripVTControlCharacters } from 'node:util';
|
|
7
|
-
import { notNullish } from '@vitest/utils';
|
|
7
|
+
import { notNullish } from '@vitest/utils/helpers';
|
|
8
8
|
|
|
9
9
|
function createBenchmarkJsonReport(files) {
|
|
10
10
|
const report = { files: [] };
|
|
@@ -183,7 +183,7 @@ class BenchmarkReporter extends DefaultReporter {
|
|
|
183
183
|
if (state === "pending" || state === "queued") return;
|
|
184
184
|
const benches = testTask.task.tasks.filter((t) => t.meta.benchmark), duration = testTask.task.result?.duration || 0;
|
|
185
185
|
if (benches.length > 0 && benches.every((t) => t.result?.state !== "run" && t.result?.state !== "queued")) {
|
|
186
|
-
let title = `\n ${getStateSymbol(testTask.task)} ${formatProjectName(testTask.project)}${getFullName(testTask.task,
|
|
186
|
+
let title = `\n ${getStateSymbol(testTask.task)} ${formatProjectName(testTask.project)}${getFullName(testTask.task, separator)}`;
|
|
187
187
|
if (duration != null && duration > this.ctx.config.slowTestThreshold) title += c.yellow(` ${Math.round(duration)}${c.dim("ms")}`);
|
|
188
188
|
this.log(title), this.log(renderTable({
|
|
189
189
|
tasks: benches,
|