vitest 0.28.4 → 0.29.0
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 +1 -1
- package/coverage.d.ts +1 -0
- package/dist/browser.d.ts +2 -1
- package/dist/browser.js +4 -4
- package/dist/child.js +89 -0
- package/dist/{chunk-api-setup.ec61b167.js → chunk-api-setup.d9eccaeb.js} +5 -5
- package/dist/{chunk-env-node.ffd1183b.js → chunk-env-node.affdd278.js} +1 -2
- package/dist/{chunk-install-pkg.13d8e7be.js → chunk-install-pkg.ea1a5ef4.js} +9 -8
- package/dist/chunk-integrations-coverage.e0a6acd2.js +51 -0
- package/dist/{chunk-integrations-globals.aacbac4d.js → chunk-integrations-globals.b56fcb06.js} +8 -8
- package/dist/{chunk-integrations-run-once.38756e30.js → chunk-integrations-run-once.9012f759.js} +1 -1
- package/dist/{chunk-integrations-utils.dae69d89.js → chunk-integrations-utils.233d6a3b.js} +2 -2
- package/dist/{chunk-node-git.d9ad64ab.js → chunk-node-git.ed5bded8.js} +1 -2
- package/dist/{chunk-node-pkg.94145502.js → chunk-node-pkg.88e7e848.js} +4423 -270
- package/dist/{chunk-runtime-mocker.eb0c265c.js → chunk-runtime-mocker.a048e92d.js} +83 -47
- package/dist/chunk-runtime-rpc.971b3848.js +61 -0
- package/dist/{chunk-runtime-setup.7dfc1a6a.js → chunk-runtime-setup.992bb661.js} +2 -2
- package/dist/{chunk-snapshot-env.6457638e.js → chunk-snapshot-env.a347d647.js} +2 -2
- package/dist/{chunk-utils-base.904102a8.js → chunk-utils-base.81f83dbd.js} +15 -1
- package/dist/{chunk-utils-global.442d1d33.js → chunk-utils-global.727b6d25.js} +1 -7
- package/dist/{chunk-utils-import.0402c9db.js → chunk-utils-import.ec15dcad.js} +18 -29
- package/dist/{chunk-utils-tasks.a9a8d8e1.js → chunk-utils-tasks.b41c8284.js} +14 -10
- package/dist/cli-wrapper.js +1 -2
- package/dist/cli.js +12 -11
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +8 -7
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +142 -0
- package/dist/coverage.js +49 -0
- package/dist/entry.js +51 -84
- package/dist/environments.d.ts +2 -1
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +9 -9
- package/dist/loader.js +2 -2
- package/dist/node.d.ts +9 -10
- package/dist/node.js +14 -12
- package/dist/runners.d.ts +4 -1
- package/dist/runners.js +221 -13
- package/dist/{types-aac763a5.d.ts → types-7cd96283.d.ts} +164 -39
- package/dist/{vendor-index.618ca5a1.js → vendor-index.2cbcdd1e.js} +18 -13
- package/dist/worker.js +14 -56
- package/package.json +16 -10
- package/dist/chunk-integrations-coverage.48e6286b.js +0 -3993
- package/dist/chunk-runtime-rpc.9c0386cc.js +0 -31
- package/dist/runners-chunk.js +0 -215
package/LICENSE.md
CHANGED
|
@@ -1097,7 +1097,7 @@ Repository: ehmicky/human-signals
|
|
|
1097
1097
|
> same "printed page" as the copyright notice for easier
|
|
1098
1098
|
> identification within third-party archives.
|
|
1099
1099
|
>
|
|
1100
|
-
> Copyright
|
|
1100
|
+
> Copyright 2022 ehmicky <ehmicky@gmail.com>
|
|
1101
1101
|
>
|
|
1102
1102
|
> Licensed under the Apache License, Version 2.0 (the "License");
|
|
1103
1103
|
> you may not use this file except in compliance with the License.
|
package/coverage.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/coverage.js'
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-7cd96283.js';
|
|
3
3
|
export { s as setupSnapshotEnvironment } from './env-afee91f0.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
|
@@ -11,6 +11,7 @@ import 'vite-node/client';
|
|
|
11
11
|
import 'vite-node/server';
|
|
12
12
|
import 'node:worker_threads';
|
|
13
13
|
import 'vite-node';
|
|
14
|
+
import 'source-map';
|
|
14
15
|
import 'node:fs';
|
|
15
16
|
|
|
16
17
|
declare function setupCommonEnv(config: ResolvedConfig): Promise<void>;
|
package/dist/browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
export { s as setupCommonEnv } from './chunk-runtime-setup.
|
|
3
|
-
export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.
|
|
2
|
+
export { s as setupCommonEnv } from './chunk-runtime-setup.992bb661.js';
|
|
3
|
+
export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './chunk-integrations-run-once.
|
|
6
|
-
import './chunk-utils-global.
|
|
5
|
+
import './chunk-integrations-run-once.9012f759.js';
|
|
6
|
+
import './chunk-utils-global.727b6d25.js';
|
|
7
7
|
import 'pathe';
|
|
8
8
|
import './chunk-utils-env.860d90c2.js';
|
|
9
9
|
import 'std-env';
|
package/dist/child.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import v8 from 'node:v8';
|
|
2
|
+
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
3
|
+
import { parseRegexp } from '@vitest/utils';
|
|
4
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './chunk-runtime-mocker.a048e92d.js';
|
|
5
|
+
import { a as rpcDone } from './chunk-runtime-rpc.971b3848.js';
|
|
6
|
+
import 'node:url';
|
|
7
|
+
import 'vite-node/client';
|
|
8
|
+
import 'vite-node/utils';
|
|
9
|
+
import 'pathe';
|
|
10
|
+
import './vendor-index.bdee400f.js';
|
|
11
|
+
import 'acorn';
|
|
12
|
+
import 'node:module';
|
|
13
|
+
import 'node:fs';
|
|
14
|
+
import 'node:assert';
|
|
15
|
+
import 'node:process';
|
|
16
|
+
import 'node:path';
|
|
17
|
+
import 'node:util';
|
|
18
|
+
import '@vitest/runner/utils';
|
|
19
|
+
import './chunk-utils-global.727b6d25.js';
|
|
20
|
+
import './chunk-utils-env.860d90c2.js';
|
|
21
|
+
import 'std-env';
|
|
22
|
+
import './chunk-constants.797d3ebf.js';
|
|
23
|
+
import './chunk-utils-base.81f83dbd.js';
|
|
24
|
+
import '@vitest/spy';
|
|
25
|
+
|
|
26
|
+
function init(ctx) {
|
|
27
|
+
const { config } = ctx;
|
|
28
|
+
process.env.VITEST_WORKER_ID = "1";
|
|
29
|
+
process.env.VITEST_POOL_ID = "1";
|
|
30
|
+
globalThis.__vitest_environment__ = config.environment;
|
|
31
|
+
globalThis.__vitest_worker__ = {
|
|
32
|
+
ctx,
|
|
33
|
+
moduleCache,
|
|
34
|
+
config,
|
|
35
|
+
mockMap,
|
|
36
|
+
rpc: createBirpc(
|
|
37
|
+
{},
|
|
38
|
+
{
|
|
39
|
+
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onWorkerExit"],
|
|
40
|
+
serialize: v8.serialize,
|
|
41
|
+
deserialize: (v) => v8.deserialize(Buffer.from(v)),
|
|
42
|
+
post(v) {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = process.send) == null ? void 0 : _a.call(process, v);
|
|
45
|
+
},
|
|
46
|
+
on(fn) {
|
|
47
|
+
process.on("message", fn);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
};
|
|
52
|
+
if (ctx.invalidates) {
|
|
53
|
+
ctx.invalidates.forEach((fsPath) => {
|
|
54
|
+
moduleCache.delete(fsPath);
|
|
55
|
+
moduleCache.delete(`mock:${fsPath}`);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
ctx.files.forEach((i) => moduleCache.delete(i));
|
|
59
|
+
}
|
|
60
|
+
function parsePossibleRegexp(str) {
|
|
61
|
+
const prefix = "$$vitest:";
|
|
62
|
+
if (typeof str === "string" && str.startsWith(prefix))
|
|
63
|
+
return parseRegexp(str.slice(prefix.length));
|
|
64
|
+
return str;
|
|
65
|
+
}
|
|
66
|
+
function unwrapConfig(config) {
|
|
67
|
+
if (config.testNamePattern)
|
|
68
|
+
config.testNamePattern = parsePossibleRegexp(config.testNamePattern);
|
|
69
|
+
return config;
|
|
70
|
+
}
|
|
71
|
+
async function run(ctx) {
|
|
72
|
+
init(ctx);
|
|
73
|
+
const { run: run2, executor } = await startViteNode(ctx);
|
|
74
|
+
await run2(ctx.files, ctx.config, ctx.environment, executor);
|
|
75
|
+
await rpcDone();
|
|
76
|
+
}
|
|
77
|
+
const procesExit = process.exit;
|
|
78
|
+
process.on("message", async (message) => {
|
|
79
|
+
if (typeof message === "object" && message.command === "start") {
|
|
80
|
+
try {
|
|
81
|
+
message.config = unwrapConfig(message.config);
|
|
82
|
+
await run(message);
|
|
83
|
+
} finally {
|
|
84
|
+
procesExit();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export { run };
|
|
@@ -11,15 +11,15 @@ import require$$1 from 'https';
|
|
|
11
11
|
import require$$2$1 from 'http';
|
|
12
12
|
import require$$7 from 'url';
|
|
13
13
|
import { A as API_PATH } from './chunk-constants.797d3ebf.js';
|
|
14
|
-
import './chunk-utils-global.
|
|
15
|
-
import { a as
|
|
14
|
+
import './chunk-utils-global.727b6d25.js';
|
|
15
|
+
import { a as parseErrorStacktrace } from './chunk-utils-tasks.b41c8284.js';
|
|
16
16
|
import 'node:url';
|
|
17
17
|
import 'pathe';
|
|
18
18
|
import './chunk-utils-env.860d90c2.js';
|
|
19
19
|
import 'std-env';
|
|
20
20
|
import '@vitest/runner/utils';
|
|
21
21
|
import '@vitest/utils';
|
|
22
|
-
import './chunk-utils-base.
|
|
22
|
+
import './chunk-utils-base.81f83dbd.js';
|
|
23
23
|
|
|
24
24
|
async function getModuleGraph(ctx, id) {
|
|
25
25
|
const graph = {};
|
|
@@ -4601,9 +4601,9 @@ class WebSocketReporter {
|
|
|
4601
4601
|
packs.forEach(([, result]) => {
|
|
4602
4602
|
var _a;
|
|
4603
4603
|
if (result == null ? void 0 : result.error)
|
|
4604
|
-
result.error.stacks =
|
|
4604
|
+
result.error.stacks = parseErrorStacktrace(result.error);
|
|
4605
4605
|
(_a = result == null ? void 0 : result.errors) == null ? void 0 : _a.forEach((error) => {
|
|
4606
|
-
error.stacks =
|
|
4606
|
+
error.stacks = parseErrorStacktrace(error);
|
|
4607
4607
|
});
|
|
4608
4608
|
});
|
|
4609
4609
|
this.clients.forEach((client) => {
|
|
@@ -417,7 +417,6 @@ const environments = {
|
|
|
417
417
|
"happy-dom": happy,
|
|
418
418
|
"edge-runtime": edge
|
|
419
419
|
};
|
|
420
|
-
const envs = Object.keys(environments);
|
|
421
420
|
const envPackageNames = {
|
|
422
421
|
"jsdom": "jsdom",
|
|
423
422
|
"happy-dom": "happy-dom",
|
|
@@ -431,4 +430,4 @@ const getEnvPackageName = (env) => {
|
|
|
431
430
|
return `vitest-environment-${env}`;
|
|
432
431
|
};
|
|
433
432
|
|
|
434
|
-
export {
|
|
433
|
+
export { environments as e, getEnvPackageName as g, populateGlobal as p };
|
|
@@ -2,8 +2,8 @@ import require$$0 from 'fs';
|
|
|
2
2
|
import k from 'path';
|
|
3
3
|
import require$$0$1 from 'util';
|
|
4
4
|
import require$$0$3 from 'child_process';
|
|
5
|
-
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.
|
|
6
|
-
import { o as onetime$1 } from './chunk-node-pkg.
|
|
5
|
+
import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.2cbcdd1e.js';
|
|
6
|
+
import { o as onetime$1 } from './chunk-node-pkg.88e7e848.js';
|
|
7
7
|
import require$$0$2 from 'os';
|
|
8
8
|
import 'node:buffer';
|
|
9
9
|
import 'node:path';
|
|
@@ -20,16 +20,16 @@ import 'pathe';
|
|
|
20
20
|
import './chunk-constants.797d3ebf.js';
|
|
21
21
|
import './chunk-utils-env.860d90c2.js';
|
|
22
22
|
import 'std-env';
|
|
23
|
-
import './chunk-integrations-coverage.
|
|
23
|
+
import './chunk-integrations-coverage.e0a6acd2.js';
|
|
24
24
|
import 'local-pkg';
|
|
25
|
-
import './chunk-env-node.
|
|
25
|
+
import './chunk-env-node.affdd278.js';
|
|
26
26
|
import 'node:console';
|
|
27
27
|
import 'picocolors';
|
|
28
28
|
import 'vite';
|
|
29
29
|
import 'node:fs';
|
|
30
30
|
import 'vite-node/client';
|
|
31
31
|
import 'vite-node/server';
|
|
32
|
-
import './chunk-utils-global.
|
|
32
|
+
import './chunk-utils-global.727b6d25.js';
|
|
33
33
|
import '@vitest/runner/utils';
|
|
34
34
|
import '@vitest/utils';
|
|
35
35
|
import 'node:fs/promises';
|
|
@@ -37,12 +37,13 @@ import 'source-map';
|
|
|
37
37
|
import 'module';
|
|
38
38
|
import 'acorn';
|
|
39
39
|
import 'acorn-walk';
|
|
40
|
+
import 'node:v8';
|
|
41
|
+
import './vendor-index.783e7f3e.js';
|
|
42
|
+
import './chunk-utils-base.81f83dbd.js';
|
|
40
43
|
import 'node:worker_threads';
|
|
41
44
|
import 'tinypool';
|
|
42
|
-
import './vendor-index.783e7f3e.js';
|
|
43
45
|
import 'perf_hooks';
|
|
44
|
-
import './chunk-utils-
|
|
45
|
-
import './chunk-utils-tasks.a9a8d8e1.js';
|
|
46
|
+
import './chunk-utils-tasks.b41c8284.js';
|
|
46
47
|
import 'crypto';
|
|
47
48
|
import 'vite-node/utils';
|
|
48
49
|
import '@vitest/utils/diff';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { importModule } from 'local-pkg';
|
|
2
|
+
|
|
3
|
+
const CoverageProviderMap = {
|
|
4
|
+
c8: "@vitest/coverage-c8",
|
|
5
|
+
istanbul: "@vitest/coverage-istanbul"
|
|
6
|
+
};
|
|
7
|
+
async function resolveCoverageProviderModule(options, loader) {
|
|
8
|
+
if (!(options == null ? void 0 : options.enabled) || !options.provider)
|
|
9
|
+
return null;
|
|
10
|
+
const provider = options.provider;
|
|
11
|
+
if (provider === "c8" || provider === "istanbul")
|
|
12
|
+
return await importModule(CoverageProviderMap[provider]);
|
|
13
|
+
let customProviderModule;
|
|
14
|
+
try {
|
|
15
|
+
customProviderModule = await loader.executeId(options.customProviderModule);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
throw new Error(`Failed to load custom CoverageProviderModule from ${options.customProviderModule}`, { cause: error });
|
|
18
|
+
}
|
|
19
|
+
if (customProviderModule.default == null)
|
|
20
|
+
throw new Error(`Custom CoverageProviderModule loaded from ${options.customProviderModule} was not the default export`);
|
|
21
|
+
return customProviderModule.default;
|
|
22
|
+
}
|
|
23
|
+
async function getCoverageProvider(options, loader) {
|
|
24
|
+
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
25
|
+
if (coverageModule)
|
|
26
|
+
return coverageModule.getProvider();
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
async function startCoverageInsideWorker(options, loader) {
|
|
30
|
+
var _a;
|
|
31
|
+
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
32
|
+
if (coverageModule)
|
|
33
|
+
return (_a = coverageModule.startCoverage) == null ? void 0 : _a.call(coverageModule);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
async function takeCoverageInsideWorker(options, loader) {
|
|
37
|
+
var _a;
|
|
38
|
+
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
39
|
+
if (coverageModule)
|
|
40
|
+
return (_a = coverageModule.takeCoverage) == null ? void 0 : _a.call(coverageModule);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
async function stopCoverageInsideWorker(options, loader) {
|
|
44
|
+
var _a;
|
|
45
|
+
const coverageModule = await resolveCoverageProviderModule(options, loader);
|
|
46
|
+
if (coverageModule)
|
|
47
|
+
return (_a = coverageModule.stopCoverage) == null ? void 0 : _a.call(coverageModule);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { CoverageProviderMap as C, stopCoverageInsideWorker as a, getCoverageProvider as g, startCoverageInsideWorker as s, takeCoverageInsideWorker as t };
|
package/dist/{chunk-integrations-globals.aacbac4d.js → chunk-integrations-globals.b56fcb06.js}
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { g as globalApis } from './chunk-constants.797d3ebf.js';
|
|
2
|
-
import { i as index } from './chunk-integrations-utils.
|
|
2
|
+
import { i as index } from './chunk-integrations-utils.233d6a3b.js';
|
|
3
3
|
import 'node:url';
|
|
4
4
|
import 'pathe';
|
|
5
5
|
import './chunk-utils-env.860d90c2.js';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
import '@vitest/runner';
|
|
8
|
-
import './chunk-utils-import.
|
|
8
|
+
import './chunk-utils-import.ec15dcad.js';
|
|
9
9
|
import '@vitest/runner/utils';
|
|
10
10
|
import '@vitest/utils';
|
|
11
|
-
import './chunk-utils-global.
|
|
11
|
+
import './chunk-utils-global.727b6d25.js';
|
|
12
12
|
import 'chai';
|
|
13
13
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
14
14
|
import '@vitest/expect';
|
|
15
|
-
import './chunk-runtime-rpc.
|
|
16
|
-
import './chunk-snapshot-env.
|
|
17
|
-
import './chunk-utils-base.
|
|
18
|
-
import './chunk-utils-tasks.
|
|
15
|
+
import './chunk-runtime-rpc.971b3848.js';
|
|
16
|
+
import './chunk-snapshot-env.a347d647.js';
|
|
17
|
+
import './chunk-utils-base.81f83dbd.js';
|
|
18
|
+
import './chunk-utils-tasks.b41c8284.js';
|
|
19
19
|
import 'util';
|
|
20
20
|
import '@vitest/spy';
|
|
21
|
-
import './chunk-integrations-run-once.
|
|
21
|
+
import './chunk-integrations-run-once.9012f759.js';
|
|
22
22
|
|
|
23
23
|
function registerApiGlobally() {
|
|
24
24
|
globalApis.forEach((api) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { suite, test, describe, it, beforeAll, beforeEach, afterAll, afterEach, onTestFailed } from '@vitest/runner';
|
|
2
|
-
import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.
|
|
3
|
-
import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.
|
|
2
|
+
import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.ec15dcad.js';
|
|
3
|
+
import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.9012f759.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
import { assert, should } from 'chai';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve } from 'pathe';
|
|
2
|
-
import { e as execa } from './vendor-index.
|
|
2
|
+
import { e as execa } from './vendor-index.2cbcdd1e.js';
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:child_process';
|
|
@@ -9,7 +9,6 @@ import 'path';
|
|
|
9
9
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
10
10
|
import 'fs';
|
|
11
11
|
import 'node:url';
|
|
12
|
-
import 'os';
|
|
13
12
|
import 'node:os';
|
|
14
13
|
import 'assert';
|
|
15
14
|
import 'events';
|