vitest 0.34.1 → 0.34.3
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 +28 -0
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +1 -1
- package/dist/child.js +11 -6
- package/dist/{chunk-api-setup.644415c3.js → chunk-api-setup.3b016b1c.js} +26 -16
- package/dist/{chunk-install-pkg.dd40cbef.js → chunk-install-pkg.a036014e.js} +8 -4
- package/dist/{chunk-integrations-globals.877c84db.js → chunk-integrations-globals.7f4b17bf.js} +5 -4
- package/dist/cli.js +11 -7
- package/dist/config.cjs +3 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +3 -1
- package/dist/coverage.d.ts +3 -3
- package/dist/entry-vm.js +5 -4
- package/dist/entry.js +5 -4
- package/dist/environments.d.ts +3 -3
- package/dist/environments.js +11 -2
- package/dist/execute.d.ts +139 -0
- package/dist/execute.js +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.js +6 -5
- package/dist/loader.js +9 -528
- package/dist/node.d.ts +4 -4
- package/dist/node.js +8 -4
- package/dist/{types-3c7dbfa5.d.ts → reporters-2ff87305.d.ts} +72 -5
- package/dist/reporters.d.ts +16 -0
- package/dist/reporters.js +16 -0
- package/dist/runners.d.ts +3 -3
- package/dist/runners.js +4 -3
- package/dist/{vendor-environments.443ecd82.js → vendor-environments.8eb4d407.js} +28 -10
- package/dist/{vendor-execute.9ab1c1a7.js → vendor-execute.a63e187f.js} +416 -211
- package/dist/vendor-index.0b5b3600.js +2062 -0
- package/dist/{vendor-index.087d1af7.js → vendor-index.29282562.js} +1 -1
- package/dist/{vendor-index.eff408fd.js → vendor-index.7178e7a2.js} +1 -1
- package/dist/{vendor-node.caa511fc.js → vendor-node.5ce5f335.js} +302 -2757
- package/dist/vendor-reporters.f6975b8d.js +2584 -0
- package/dist/vendor-tasks.f9d75aed.js +14 -0
- package/dist/{vendor-vi.271667ef.js → vendor-vi.597d9e06.js} +3 -2
- package/dist/vm.js +14 -6
- package/dist/worker.js +12 -6
- package/package.json +11 -7
- package/reporters.d.ts +1 -0
- package/dist/vendor-source-map.e6c1997b.js +0 -747
package/LICENSE.md
CHANGED
|
@@ -1924,6 +1924,34 @@ Repository: git+ssh://git@github.com/chaijs/type-detect.git
|
|
|
1924
1924
|
|
|
1925
1925
|
---------------------------------------
|
|
1926
1926
|
|
|
1927
|
+
## ufo
|
|
1928
|
+
License: MIT
|
|
1929
|
+
Repository: unjs/ufo
|
|
1930
|
+
|
|
1931
|
+
> MIT License
|
|
1932
|
+
>
|
|
1933
|
+
> Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
1934
|
+
>
|
|
1935
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1936
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
1937
|
+
> in the Software without restriction, including without limitation the rights
|
|
1938
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1939
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
1940
|
+
> furnished to do so, subject to the following conditions:
|
|
1941
|
+
>
|
|
1942
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
1943
|
+
> copies or substantial portions of the Software.
|
|
1944
|
+
>
|
|
1945
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1946
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1947
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1948
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1949
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1950
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1951
|
+
> SOFTWARE.
|
|
1952
|
+
|
|
1953
|
+
---------------------------------------
|
|
1954
|
+
|
|
1927
1955
|
## which
|
|
1928
1956
|
License: ISC
|
|
1929
1957
|
By: Isaac Z. Schlueter
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './
|
|
3
|
-
import '@vitest/snapshot';
|
|
4
|
-
import '@vitest/expect';
|
|
2
|
+
import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './reporters-2ff87305.js';
|
|
5
3
|
import 'vite';
|
|
6
4
|
import 'vite-node';
|
|
5
|
+
import '@vitest/snapshot';
|
|
6
|
+
import '@vitest/expect';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
package/dist/browser.js
CHANGED
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals)
|
|
16
|
-
(await import('./chunk-integrations-globals.
|
|
16
|
+
(await import('./chunk-integrations-globals.7f4b17bf.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
function setupDefines(defines) {
|
|
19
19
|
for (const key in defines)
|
package/dist/child.js
CHANGED
|
@@ -2,24 +2,29 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import v8 from 'node:v8';
|
|
3
3
|
import { c as createBirpc } from './vendor-index.b271ebe4.js';
|
|
4
4
|
import { parseRegexp } from '@vitest/utils';
|
|
5
|
-
import { l as loadEnvironment } from './vendor-environments.
|
|
6
|
-
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.
|
|
5
|
+
import { l as loadEnvironment } from './vendor-environments.8eb4d407.js';
|
|
6
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.a63e187f.js';
|
|
7
7
|
import { r as rpcDone, c as createSafeRpc } from './vendor-rpc.cbd8e972.js';
|
|
8
8
|
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'pathe';
|
|
11
|
-
import '
|
|
11
|
+
import './vendor-index.0b5b3600.js';
|
|
12
|
+
import 'acorn';
|
|
13
|
+
import 'node:module';
|
|
14
|
+
import 'node:fs';
|
|
15
|
+
import 'node:assert';
|
|
16
|
+
import 'node:process';
|
|
17
|
+
import 'node:path';
|
|
18
|
+
import 'node:util';
|
|
12
19
|
import 'node:console';
|
|
20
|
+
import 'local-pkg';
|
|
13
21
|
import 'node:vm';
|
|
14
22
|
import 'vite-node/client';
|
|
15
23
|
import 'vite-node/utils';
|
|
16
24
|
import '@vitest/utils/error';
|
|
17
25
|
import './vendor-paths.84fc7a99.js';
|
|
18
26
|
import './vendor-global.97e4527c.js';
|
|
19
|
-
import 'node:fs';
|
|
20
27
|
import './vendor-base.9c08bbd0.js';
|
|
21
|
-
import 'node:path';
|
|
22
|
-
import 'node:module';
|
|
23
28
|
import 'vite-node/constants';
|
|
24
29
|
|
|
25
30
|
async function init(ctx) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, promises } from 'node:fs';
|
|
2
2
|
import { dirname } from 'pathe';
|
|
3
3
|
import { c as createBirpc } from './vendor-index.b271ebe4.js';
|
|
4
4
|
import require$$0$2 from 'stream';
|
|
@@ -13,9 +13,9 @@ import require$$2$1 from 'http';
|
|
|
13
13
|
import require$$7 from 'url';
|
|
14
14
|
import { g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8.js';
|
|
15
15
|
import { A as API_PATH } from './vendor-constants.538d9b49.js';
|
|
16
|
-
import './vendor-index.
|
|
16
|
+
import './vendor-index.29282562.js';
|
|
17
17
|
import '@vitest/utils';
|
|
18
|
-
import {
|
|
18
|
+
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
19
19
|
import { i as isPrimitive } from './vendor-base.9c08bbd0.js';
|
|
20
20
|
import 'std-env';
|
|
21
21
|
import '@vitest/runner/utils';
|
|
@@ -4543,30 +4543,40 @@ function setup(vitestOrWorkspace, server) {
|
|
|
4543
4543
|
resolveSnapshotRawPath(testPath, rawPath) {
|
|
4544
4544
|
return ctx.snapshot.resolveRawPath(testPath, rawPath);
|
|
4545
4545
|
},
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
return promises.mkdir(id, { recursive: true });
|
|
4546
|
+
async readSnapshotFile(snapshotPath) {
|
|
4547
|
+
if (!ctx.snapshot.resolvedPaths.has(snapshotPath) || !existsSync(snapshotPath))
|
|
4548
|
+
return null;
|
|
4549
|
+
return promises.readFile(snapshotPath, "utf-8");
|
|
4551
4550
|
},
|
|
4552
|
-
async
|
|
4553
|
-
if (!existsSync(id))
|
|
4551
|
+
async readTestFile(id) {
|
|
4552
|
+
if (!ctx.state.filesMap.has(id) || !existsSync(id))
|
|
4554
4553
|
return null;
|
|
4555
4554
|
return promises.readFile(id, "utf-8");
|
|
4556
4555
|
},
|
|
4556
|
+
async saveTestFile(id, content) {
|
|
4557
|
+
if (!ctx.state.filesMap.has(id) || !existsSync(id))
|
|
4558
|
+
return;
|
|
4559
|
+
return promises.writeFile(id, content, "utf-8");
|
|
4560
|
+
},
|
|
4561
|
+
async saveSnapshotFile(id, content) {
|
|
4562
|
+
if (!ctx.snapshot.resolvedPaths.has(id))
|
|
4563
|
+
return;
|
|
4564
|
+
await promises.mkdir(dirname(id), { recursive: true });
|
|
4565
|
+
return promises.writeFile(id, content, "utf-8");
|
|
4566
|
+
},
|
|
4567
|
+
async removeSnapshotFile(id) {
|
|
4568
|
+
if (!ctx.snapshot.resolvedPaths.has(id) || !existsSync(id))
|
|
4569
|
+
return;
|
|
4570
|
+
return promises.unlink(id);
|
|
4571
|
+
},
|
|
4557
4572
|
snapshotSaved(snapshot) {
|
|
4558
4573
|
ctx.snapshot.add(snapshot);
|
|
4559
4574
|
},
|
|
4560
|
-
async writeFile(id, content, ensureDir) {
|
|
4561
|
-
if (ensureDir)
|
|
4562
|
-
await promises.mkdir(dirname(id), { recursive: true });
|
|
4563
|
-
return await promises.writeFile(id, content, "utf-8");
|
|
4564
|
-
},
|
|
4565
4575
|
async rerun(files) {
|
|
4566
4576
|
await ctx.rerunFiles(files);
|
|
4567
4577
|
},
|
|
4568
4578
|
getConfig() {
|
|
4569
|
-
return
|
|
4579
|
+
return vitestOrWorkspace.config;
|
|
4570
4580
|
},
|
|
4571
4581
|
async getTransformResult(id) {
|
|
4572
4582
|
const result = await ctx.vitenode.transformRequest(id);
|
|
@@ -4,7 +4,7 @@ import { g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8
|
|
|
4
4
|
import require$$2 from 'util';
|
|
5
5
|
import require$$0$1 from 'child_process';
|
|
6
6
|
import { p as pathKeyExports, s as signalExitExports, m as mergeStream$1, g as getStreamExports, c as crossSpawnExports } from './vendor-index.1f85e5f1.js';
|
|
7
|
-
import { o as onetimeExports } from './vendor-node.
|
|
7
|
+
import { o as onetimeExports } from './vendor-node.5ce5f335.js';
|
|
8
8
|
import require$$0 from 'os';
|
|
9
9
|
import 'node:buffer';
|
|
10
10
|
import 'node:path';
|
|
@@ -26,7 +26,7 @@ import 'vite-node/utils';
|
|
|
26
26
|
import 'vite-node/client';
|
|
27
27
|
import '@vitest/snapshot/manager';
|
|
28
28
|
import 'vite-node/server';
|
|
29
|
-
import './vendor-index.
|
|
29
|
+
import './vendor-index.29282562.js';
|
|
30
30
|
import 'std-env';
|
|
31
31
|
import '@vitest/runner/utils';
|
|
32
32
|
import '@vitest/utils';
|
|
@@ -39,8 +39,10 @@ import './vendor-base.9c08bbd0.js';
|
|
|
39
39
|
import 'node:worker_threads';
|
|
40
40
|
import 'tinypool';
|
|
41
41
|
import 'local-pkg';
|
|
42
|
+
import './vendor-reporters.f6975b8d.js';
|
|
42
43
|
import 'node:perf_hooks';
|
|
43
|
-
import './vendor-
|
|
44
|
+
import './vendor-tasks.f9d75aed.js';
|
|
45
|
+
import '@vitest/utils/source-map';
|
|
44
46
|
import 'node:module';
|
|
45
47
|
import 'node:crypto';
|
|
46
48
|
import 'node:fs/promises';
|
|
@@ -49,7 +51,9 @@ import 'acorn';
|
|
|
49
51
|
import 'acorn-walk';
|
|
50
52
|
import 'magic-string';
|
|
51
53
|
import 'strip-literal';
|
|
52
|
-
import './vendor-environments.
|
|
54
|
+
import './vendor-environments.8eb4d407.js';
|
|
55
|
+
import './vendor-index.0b5b3600.js';
|
|
56
|
+
import 'node:assert';
|
|
53
57
|
import 'node:console';
|
|
54
58
|
import 'node:readline';
|
|
55
59
|
import 'readline';
|
package/dist/{chunk-integrations-globals.877c84db.js → chunk-integrations-globals.7f4b17bf.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { g as globalApis } from './vendor-constants.538d9b49.js';
|
|
2
|
-
import { i as index } from './vendor-index.
|
|
2
|
+
import { i as index } from './vendor-index.7178e7a2.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import './vendor-vi.
|
|
4
|
+
import './vendor-vi.597d9e06.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
|
-
import './vendor-index.
|
|
7
|
+
import './vendor-index.29282562.js';
|
|
8
8
|
import 'pathe';
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import './vendor-global.97e4527c.js';
|
|
@@ -13,7 +13,8 @@ import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
|
13
13
|
import '@vitest/expect';
|
|
14
14
|
import '@vitest/snapshot';
|
|
15
15
|
import '@vitest/utils/error';
|
|
16
|
-
import './vendor-
|
|
16
|
+
import './vendor-tasks.f9d75aed.js';
|
|
17
|
+
import '@vitest/utils/source-map';
|
|
17
18
|
import 'util';
|
|
18
19
|
import './vendor-date.6e993429.js';
|
|
19
20
|
import '@vitest/spy';
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { v as version, s as startVitest
|
|
5
|
-
import './vendor-index.
|
|
4
|
+
import { v as version, s as startVitest } from './vendor-node.5ce5f335.js';
|
|
5
|
+
import './vendor-index.29282562.js';
|
|
6
|
+
import { d as divider } from './vendor-reporters.f6975b8d.js';
|
|
6
7
|
import { t as toArray } from './vendor-base.9c08bbd0.js';
|
|
7
8
|
import 'vite';
|
|
8
9
|
import 'node:path';
|
|
@@ -32,10 +33,6 @@ import 'tinypool';
|
|
|
32
33
|
import '@vitest/utils';
|
|
33
34
|
import 'local-pkg';
|
|
34
35
|
import 'std-env';
|
|
35
|
-
import 'node:perf_hooks';
|
|
36
|
-
import './vendor-source-map.e6c1997b.js';
|
|
37
|
-
import '@vitest/runner/utils';
|
|
38
|
-
import 'node:module';
|
|
39
36
|
import 'node:crypto';
|
|
40
37
|
import './vendor-index.1f85e5f1.js';
|
|
41
38
|
import 'node:buffer';
|
|
@@ -43,17 +40,24 @@ import 'child_process';
|
|
|
43
40
|
import 'assert';
|
|
44
41
|
import 'buffer';
|
|
45
42
|
import 'node:util';
|
|
43
|
+
import '@vitest/utils/source-map';
|
|
46
44
|
import 'node:fs/promises';
|
|
47
45
|
import 'module';
|
|
48
46
|
import 'acorn';
|
|
49
47
|
import 'acorn-walk';
|
|
48
|
+
import '@vitest/runner/utils';
|
|
50
49
|
import 'magic-string';
|
|
51
50
|
import 'strip-literal';
|
|
52
|
-
import './vendor-environments.
|
|
51
|
+
import './vendor-environments.8eb4d407.js';
|
|
52
|
+
import './vendor-index.0b5b3600.js';
|
|
53
|
+
import 'node:module';
|
|
54
|
+
import 'node:assert';
|
|
53
55
|
import 'node:console';
|
|
54
56
|
import 'node:readline';
|
|
55
57
|
import 'readline';
|
|
56
58
|
import './vendor-global.97e4527c.js';
|
|
59
|
+
import 'node:perf_hooks';
|
|
60
|
+
import './vendor-tasks.f9d75aed.js';
|
|
57
61
|
|
|
58
62
|
const cli = cac("vitest");
|
|
59
63
|
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", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp 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("--single-thread", "Run tests inside a single thread, requires --threads (default: false)").option("--experimental-vm-threads", "Run tests in a worker pool using VM isolation (default: false)").option("--experimental-vm-worker-memory-limit", "Set the maximum allowed memory for a worker. When reached, a new worker will be created instead").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--isolate", "Isolate environment for each test file (default: true)").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").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, use --sequence.concurrent to run tests in parallel)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed", { default: 0 }).option("--retry <times>", "Retry the test specific number of times if it fails", { default: 0 }).help();
|
package/dist/config.cjs
CHANGED
|
@@ -22,6 +22,7 @@ const defaultCoverageExcludes = [
|
|
|
22
22
|
"**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)",
|
|
23
23
|
"**/__tests__/**",
|
|
24
24
|
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
|
|
25
|
+
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
25
26
|
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
26
27
|
];
|
|
27
28
|
const coverageConfigDefaults = {
|
|
@@ -33,7 +34,8 @@ const coverageConfigDefaults = {
|
|
|
33
34
|
exclude: defaultCoverageExcludes,
|
|
34
35
|
reportOnFailure: false,
|
|
35
36
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
36
|
-
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
37
|
+
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"],
|
|
38
|
+
allowExternal: false
|
|
37
39
|
};
|
|
38
40
|
const fakeTimersDefaults = {
|
|
39
41
|
loopLimit: 1e4,
|
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
|
|
3
|
-
import { c as ResolvedCoverageOptions, U as UserConfig, d as CoverageV8Options, P as ProjectConfig } from './
|
|
4
|
-
import '@vitest/snapshot';
|
|
5
|
-
import '@vitest/expect';
|
|
3
|
+
import { c as ResolvedCoverageOptions, U as UserConfig, d as CoverageV8Options, P as ProjectConfig } from './reporters-2ff87305.js';
|
|
6
4
|
import '@vitest/runner';
|
|
7
5
|
import 'vite-node';
|
|
6
|
+
import '@vitest/snapshot';
|
|
7
|
+
import '@vitest/expect';
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
9
|
import '@vitest/utils';
|
|
10
10
|
import 'tinybench';
|
package/dist/config.js
CHANGED
|
@@ -20,6 +20,7 @@ const defaultCoverageExcludes = [
|
|
|
20
20
|
"**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)",
|
|
21
21
|
"**/__tests__/**",
|
|
22
22
|
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*",
|
|
23
|
+
"**/vitest.{workspace,projects}.[jt]s?(on)",
|
|
23
24
|
"**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
|
|
24
25
|
];
|
|
25
26
|
const coverageConfigDefaults = {
|
|
@@ -31,7 +32,8 @@ const coverageConfigDefaults = {
|
|
|
31
32
|
exclude: defaultCoverageExcludes,
|
|
32
33
|
reportOnFailure: false,
|
|
33
34
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
34
|
-
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
35
|
+
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"],
|
|
36
|
+
allowExternal: false
|
|
35
37
|
};
|
|
36
38
|
const fakeTimersDefaults = {
|
|
37
39
|
loopLimit: 1e4,
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BaseCoverageOptions, c as ResolvedCoverageOptions } from './
|
|
2
|
-
import '@vitest/snapshot';
|
|
3
|
-
import '@vitest/expect';
|
|
1
|
+
import { B as BaseCoverageOptions, c as ResolvedCoverageOptions } from './reporters-2ff87305.js';
|
|
4
2
|
import 'vite';
|
|
5
3
|
import '@vitest/runner';
|
|
6
4
|
import 'vite-node';
|
|
5
|
+
import '@vitest/snapshot';
|
|
6
|
+
import '@vitest/expect';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
package/dist/entry-vm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { setupColors, createColors } from '@vitest/utils';
|
|
|
6
6
|
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.9378c9a4.js';
|
|
7
7
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor-coverage.78040316.js';
|
|
8
8
|
import { g as getWorkerState } from './vendor-global.97e4527c.js';
|
|
9
|
-
import { i as index } from './vendor-index.
|
|
9
|
+
import { i as index } from './vendor-index.7178e7a2.js';
|
|
10
10
|
import { setupCommonEnv } from './browser.js';
|
|
11
11
|
import 'chai';
|
|
12
12
|
import '@vitest/snapshot/environment';
|
|
@@ -14,15 +14,16 @@ import 'pathe';
|
|
|
14
14
|
import './vendor-paths.84fc7a99.js';
|
|
15
15
|
import 'node:url';
|
|
16
16
|
import './vendor-rpc.cbd8e972.js';
|
|
17
|
-
import './vendor-vi.
|
|
17
|
+
import './vendor-vi.597d9e06.js';
|
|
18
18
|
import '@vitest/runner/utils';
|
|
19
|
-
import './vendor-index.
|
|
19
|
+
import './vendor-index.29282562.js';
|
|
20
20
|
import 'std-env';
|
|
21
21
|
import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
22
22
|
import '@vitest/expect';
|
|
23
23
|
import '@vitest/snapshot';
|
|
24
24
|
import '@vitest/utils/error';
|
|
25
|
-
import './vendor-
|
|
25
|
+
import './vendor-tasks.f9d75aed.js';
|
|
26
|
+
import '@vitest/utils/source-map';
|
|
26
27
|
import 'util';
|
|
27
28
|
import './vendor-date.6e993429.js';
|
|
28
29
|
import '@vitest/spy';
|
package/dist/entry.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { startTests } from '@vitest/runner';
|
|
3
|
-
import './vendor-index.
|
|
4
|
-
import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.
|
|
3
|
+
import './vendor-index.29282562.js';
|
|
4
|
+
import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.597d9e06.js';
|
|
5
5
|
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor-coverage.78040316.js';
|
|
6
6
|
import { V as VitestSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './vendor-index.9378c9a4.js';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
8
|
import { isatty } from 'node:tty';
|
|
9
9
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
10
10
|
import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
|
|
11
|
-
import { i as index } from './vendor-index.
|
|
11
|
+
import { i as index } from './vendor-index.7178e7a2.js';
|
|
12
12
|
import { setupCommonEnv } from './browser.js';
|
|
13
13
|
import { g as getWorkerState } from './vendor-global.97e4527c.js';
|
|
14
14
|
import 'pathe';
|
|
@@ -19,7 +19,8 @@ import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
|
19
19
|
import '@vitest/expect';
|
|
20
20
|
import '@vitest/snapshot';
|
|
21
21
|
import '@vitest/utils/error';
|
|
22
|
-
import './vendor-
|
|
22
|
+
import './vendor-tasks.f9d75aed.js';
|
|
23
|
+
import '@vitest/utils/source-map';
|
|
23
24
|
import 'util';
|
|
24
25
|
import './vendor-date.6e993429.js';
|
|
25
26
|
import '@vitest/spy';
|
package/dist/environments.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as Environment } from './
|
|
2
|
-
import '@vitest/snapshot';
|
|
3
|
-
import '@vitest/expect';
|
|
1
|
+
import { E as Environment } from './reporters-2ff87305.js';
|
|
4
2
|
import 'vite';
|
|
5
3
|
import '@vitest/runner';
|
|
6
4
|
import 'vite-node';
|
|
5
|
+
import '@vitest/snapshot';
|
|
6
|
+
import '@vitest/expect';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
9
|
import 'tinybench';
|
package/dist/environments.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.
|
|
1
|
+
export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.8eb4d407.js';
|
|
2
2
|
import 'node:url';
|
|
3
3
|
import 'pathe';
|
|
4
|
-
import '
|
|
4
|
+
import './vendor-index.0b5b3600.js';
|
|
5
|
+
import 'acorn';
|
|
6
|
+
import 'node:module';
|
|
7
|
+
import 'node:fs';
|
|
8
|
+
import 'node:assert';
|
|
9
|
+
import 'node:process';
|
|
10
|
+
import 'node:path';
|
|
11
|
+
import 'node:v8';
|
|
12
|
+
import 'node:util';
|
|
5
13
|
import 'node:console';
|
|
14
|
+
import 'local-pkg';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import vm from 'node:vm';
|
|
2
|
+
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
|
+
import { ViteNodeRunnerOptions } from 'vite-node';
|
|
4
|
+
import { h as PendingSuiteMock, M as MockFactory, i as WorkerGlobalState, j as MockMap, k as RuntimeRPC } from './reporters-2ff87305.js';
|
|
5
|
+
import 'vite';
|
|
6
|
+
import '@vitest/runner';
|
|
7
|
+
import '@vitest/snapshot';
|
|
8
|
+
import '@vitest/expect';
|
|
9
|
+
import '@vitest/runner/utils';
|
|
10
|
+
import '@vitest/utils';
|
|
11
|
+
import 'tinybench';
|
|
12
|
+
import '@vitest/snapshot/manager';
|
|
13
|
+
import 'vite-node/server';
|
|
14
|
+
import 'node:worker_threads';
|
|
15
|
+
import 'rollup';
|
|
16
|
+
import 'node:fs';
|
|
17
|
+
import 'chai';
|
|
18
|
+
|
|
19
|
+
type Key = string | symbol;
|
|
20
|
+
declare class VitestMocker {
|
|
21
|
+
executor: VitestExecutor;
|
|
22
|
+
static pendingIds: PendingSuiteMock[];
|
|
23
|
+
private spyModule?;
|
|
24
|
+
private resolveCache;
|
|
25
|
+
private primitives;
|
|
26
|
+
private filterPublicKeys;
|
|
27
|
+
constructor(executor: VitestExecutor);
|
|
28
|
+
private get root();
|
|
29
|
+
private get mockMap();
|
|
30
|
+
private get moduleCache();
|
|
31
|
+
private get moduleDirectories();
|
|
32
|
+
initializeSpyModule(): Promise<void>;
|
|
33
|
+
private deleteCachedItem;
|
|
34
|
+
private isAModuleDirectory;
|
|
35
|
+
getSuiteFilepath(): string;
|
|
36
|
+
private createError;
|
|
37
|
+
getMocks(): {
|
|
38
|
+
[x: string]: string | MockFactory | null;
|
|
39
|
+
};
|
|
40
|
+
private resolvePath;
|
|
41
|
+
resolveMocks(): Promise<void>;
|
|
42
|
+
private callFunctionMock;
|
|
43
|
+
getMockPath(dep: string): string;
|
|
44
|
+
getDependencyMock(id: string): string | MockFactory | null;
|
|
45
|
+
normalizePath(path: string): string;
|
|
46
|
+
resolveMockPath(mockPath: string, external: string | null): string | null;
|
|
47
|
+
mockObject(object: Record<Key, any>, mockExports?: Record<Key, any>): Record<Key, any>;
|
|
48
|
+
unmockPath(path: string): void;
|
|
49
|
+
mockPath(originalId: string, path: string, external: string | null, factory?: MockFactory): void;
|
|
50
|
+
importActual<T>(rawId: string, importee: string): Promise<T>;
|
|
51
|
+
importMock(rawId: string, importee: string): Promise<any>;
|
|
52
|
+
requestWithMock(url: string, callstack: string[]): Promise<any>;
|
|
53
|
+
queueMock(id: string, importer: string, factory?: MockFactory): void;
|
|
54
|
+
queueUnmock(id: string, importer: string): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ModuleEvaluateOptions {
|
|
58
|
+
timeout?: vm.RunningScriptOptions['timeout'] | undefined;
|
|
59
|
+
breakOnSigint?: vm.RunningScriptOptions['breakOnSigint'] | undefined;
|
|
60
|
+
}
|
|
61
|
+
type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
|
|
62
|
+
assert: Object;
|
|
63
|
+
}) => VMModule | Promise<VMModule>;
|
|
64
|
+
type ModuleStatus = 'unlinked' | 'linking' | 'linked' | 'evaluating' | 'evaluated' | 'errored';
|
|
65
|
+
declare class VMModule {
|
|
66
|
+
dependencySpecifiers: readonly string[];
|
|
67
|
+
error: any;
|
|
68
|
+
identifier: string;
|
|
69
|
+
context: vm.Context;
|
|
70
|
+
namespace: Object;
|
|
71
|
+
status: ModuleStatus;
|
|
72
|
+
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
|
|
73
|
+
link(linker: ModuleLinker): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class FileMap {
|
|
77
|
+
private fsCache;
|
|
78
|
+
private fsBufferCache;
|
|
79
|
+
readFile(path: string): string;
|
|
80
|
+
readBuffer(path: string): Buffer;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface ExternalModulesExecutorOptions extends ExecuteOptions {
|
|
84
|
+
context: vm.Context;
|
|
85
|
+
fileMap: FileMap;
|
|
86
|
+
packageCache: Map<string, any>;
|
|
87
|
+
}
|
|
88
|
+
declare class ExternalModulesExecutor {
|
|
89
|
+
private options;
|
|
90
|
+
private cjs;
|
|
91
|
+
private esm;
|
|
92
|
+
private vite;
|
|
93
|
+
private context;
|
|
94
|
+
private fs;
|
|
95
|
+
private resolvers;
|
|
96
|
+
constructor(options: ExternalModulesExecutorOptions);
|
|
97
|
+
importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
|
|
98
|
+
resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
|
|
99
|
+
resolve(specifier: string, parent: string): Promise<string>;
|
|
100
|
+
private findNearestPackageData;
|
|
101
|
+
private wrapCoreSynteticModule;
|
|
102
|
+
private wrapCommonJsSynteticModule;
|
|
103
|
+
private getModuleInformation;
|
|
104
|
+
private createModule;
|
|
105
|
+
import(identifier: string): Promise<Object>;
|
|
106
|
+
require(identifier: string): any;
|
|
107
|
+
createRequire(identifier: string): NodeRequire;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface ExecuteOptions extends ViteNodeRunnerOptions {
|
|
111
|
+
mockMap: MockMap;
|
|
112
|
+
packageCache: Map<string, string>;
|
|
113
|
+
moduleDirectories?: string[];
|
|
114
|
+
context?: vm.Context;
|
|
115
|
+
state: WorkerGlobalState;
|
|
116
|
+
transform: RuntimeRPC['transform'];
|
|
117
|
+
}
|
|
118
|
+
declare class VitestExecutor extends ViteNodeRunner {
|
|
119
|
+
options: ExecuteOptions;
|
|
120
|
+
mocker: VitestMocker;
|
|
121
|
+
externalModules?: ExternalModulesExecutor;
|
|
122
|
+
private primitives;
|
|
123
|
+
constructor(options: ExecuteOptions);
|
|
124
|
+
protected getContextPrimitives(): {
|
|
125
|
+
Object: ObjectConstructor;
|
|
126
|
+
Reflect: typeof Reflect;
|
|
127
|
+
Symbol: SymbolConstructor;
|
|
128
|
+
};
|
|
129
|
+
get state(): WorkerGlobalState;
|
|
130
|
+
shouldResolveId(id: string, _importee?: string | undefined): boolean;
|
|
131
|
+
originalResolveUrl(id: string, importer?: string): Promise<[url: string, fsPath: string]>;
|
|
132
|
+
resolveUrl(id: string, importer?: string): Promise<[string, string]>;
|
|
133
|
+
protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
|
|
134
|
+
importExternalModule(path: string): Promise<any>;
|
|
135
|
+
dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
|
|
136
|
+
prepareContext(context: Record<string, any>): Record<string, any>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { VitestExecutor };
|
package/dist/execute.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Test, File, TaskResultPack, CancelReason } from '@vitest/runner';
|
|
2
2
|
export { DoneCallback, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { l as BenchmarkAPI, F as FakeTimerInstallOpts, m as MockFactoryWithHelper, n as RuntimeConfig, A as AfterSuiteRunMeta, o as UserConsoleLog, R as ResolvedConfig, p as ModuleGraphData, q as Reporter } from './reporters-2ff87305.js';
|
|
4
|
+
export { I as ApiConfig, a4 as ArgumentsType, a3 as Arrayable, a1 as Awaitable, B as BaseCoverageOptions, ai as BenchFunction, ag as Benchmark, ah as BenchmarkResult, af as BenchmarkUserOptions, y as BuiltinEnvironment, G as CSSModuleScopeStrategy, u as CollectLineNumbers, v as CollectLines, a6 as Constructable, x as Context, Z as ContextRPC, X as ContextTestEnvironment, ad as CoverageIstanbulOptions, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule, ac as CoverageReporter, d as CoverageV8Options, ae as CustomProviderOptions, L as DepsOptimizationOptions, E as Environment, K as EnvironmentOptions, a8 as EnvironmentReturn, H as HappyDOMOptions, O as InlineConfig, J as JSDOMOptions, a7 as ModuleCache, a5 as MutableArray, a2 as Nullable, aa as OnServerRestartHandler, P as ProjectConfig, r as RawErrsMap, ab as ReportContext, $ as ResolveIdFunction, c as ResolvedCoverageOptions, Y as ResolvedTestEnvironment, w as RootAndTarget, S as RunnerRPC, k as RuntimeRPC, N as TransformModePatterns, t as TscErrorInfo, Q as TypecheckConfig, U as UserConfig, e as Vitest, z as VitestEnvironment, D as VitestPool, V as VitestRunMode, a9 as VmEnvironmentReturn, _ as WorkerContext, i as WorkerGlobalState, a0 as WorkerRPC } from './reporters-2ff87305.js';
|
|
5
5
|
import { ExpectStatic } from '@vitest/expect';
|
|
6
6
|
export { Assertion, AsymmetricMatchersContaining, ExpectStatic, JestAssertion } from '@vitest/expect';
|
|
7
7
|
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
|
|
@@ -316,12 +316,12 @@ interface VitestUtils {
|
|
|
316
316
|
/**
|
|
317
317
|
* Makes value available on global namespace.
|
|
318
318
|
* Useful, if you want to have global variables available, like `IntersectionObserver`.
|
|
319
|
-
* You can return it back to original value with `vi.
|
|
319
|
+
* You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option.
|
|
320
320
|
*/
|
|
321
321
|
stubGlobal(name: string | symbol | number, value: unknown): this;
|
|
322
322
|
/**
|
|
323
323
|
* Changes the value of `import.meta.env` and `process.env`.
|
|
324
|
-
* You can return it back to original value with `vi.
|
|
324
|
+
* You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
|
|
325
325
|
*/
|
|
326
326
|
stubEnv(name: string, value: string): this;
|
|
327
327
|
/**
|
|
@@ -351,7 +351,7 @@ interface VitestUtils {
|
|
|
351
351
|
declare const vitest: VitestUtils;
|
|
352
352
|
declare const vi: VitestUtils;
|
|
353
353
|
|
|
354
|
-
declare function getRunningMode(): "
|
|
354
|
+
declare function getRunningMode(): "run" | "watch";
|
|
355
355
|
declare function isWatchMode(): boolean;
|
|
356
356
|
|
|
357
357
|
interface TransformResultWithSource extends TransformResult {
|
|
@@ -372,10 +372,11 @@ interface WebSocketHandlers {
|
|
|
372
372
|
resolveSnapshotRawPath(testPath: string, rawPath: string): string;
|
|
373
373
|
getModuleGraph(id: string): Promise<ModuleGraphData>;
|
|
374
374
|
getTransformResult(id: string): Promise<TransformResultWithSource | undefined>;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
readSnapshotFile(id: string): Promise<string | null>;
|
|
376
|
+
readTestFile(id: string): Promise<string | null>;
|
|
377
|
+
saveTestFile(id: string, content: string): Promise<void>;
|
|
378
|
+
saveSnapshotFile(id: string, content: string): Promise<void>;
|
|
379
|
+
removeSnapshotFile(id: string): Promise<void>;
|
|
379
380
|
snapshotSaved(snapshot: SnapshotResult): void;
|
|
380
381
|
rerun(files: string[]): Promise<void>;
|
|
381
382
|
updateSnapshot(file?: File): Promise<void>;
|