vitest 0.34.0 → 0.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +28 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/child.js +11 -6
- package/dist/{chunk-api-setup.644415c3.js → chunk-api-setup.cc5282f7.js} +25 -15
- package/dist/{chunk-install-pkg.dd70081b.js → chunk-install-pkg.7e19b3a0.js} +6 -3
- package/dist/{chunk-integrations-globals.877c84db.js → chunk-integrations-globals.522ae1ae.js} +4 -3
- package/dist/cli.js +6 -3
- package/dist/config.d.ts +1 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/entry-vm.js +4 -3
- package/dist/entry.js +4 -3
- package/dist/environments.d.ts +1 -1
- 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 +5 -4
- package/dist/loader.js +9 -528
- package/dist/node.d.ts +2 -2
- package/dist/node.js +6 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +3 -2
- package/dist/{types-3c7dbfa5.d.ts → types-63abf2e0.d.ts} +63 -2
- package/dist/{vendor-environments.443ecd82.js → vendor-environments.37f266a9.js} +13 -6
- package/dist/{vendor-execute.9ab1c1a7.js → vendor-execute.4fc8203a.js} +409 -206
- package/dist/vendor-index.0b5b3600.js +2062 -0
- package/dist/{vendor-index.eff408fd.js → vendor-index.b5efbd68.js} +1 -1
- package/dist/{vendor-node.00226ab1.js → vendor-node.7b1bd3c5.js} +196 -122
- package/dist/vendor-tasks.f9d75aed.js +14 -0
- package/dist/{vendor-vi.271667ef.js → vendor-vi.f8055ff2.js} +2 -1
- package/dist/vm.js +14 -6
- package/dist/worker.js +12 -6
- package/package.json +7 -7
- 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,5 +1,5 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './types-
|
|
2
|
+
import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './types-63abf2e0.js';
|
|
3
3
|
import '@vitest/snapshot';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
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.522ae1ae.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.37f266a9.js';
|
|
6
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.4fc8203a.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';
|
|
@@ -15,7 +15,7 @@ import { g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8
|
|
|
15
15
|
import { A as API_PATH } from './vendor-constants.538d9b49.js';
|
|
16
16
|
import './vendor-index.087d1af7.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.7b1bd3c5.js';
|
|
8
8
|
import require$$0 from 'os';
|
|
9
9
|
import 'node:buffer';
|
|
10
10
|
import 'node:path';
|
|
@@ -40,7 +40,8 @@ import 'node:worker_threads';
|
|
|
40
40
|
import 'tinypool';
|
|
41
41
|
import 'local-pkg';
|
|
42
42
|
import 'node:perf_hooks';
|
|
43
|
-
import './vendor-
|
|
43
|
+
import './vendor-tasks.f9d75aed.js';
|
|
44
|
+
import '@vitest/utils/source-map';
|
|
44
45
|
import 'node:module';
|
|
45
46
|
import 'node:crypto';
|
|
46
47
|
import 'node:fs/promises';
|
|
@@ -49,7 +50,9 @@ import 'acorn';
|
|
|
49
50
|
import 'acorn-walk';
|
|
50
51
|
import 'magic-string';
|
|
51
52
|
import 'strip-literal';
|
|
52
|
-
import './vendor-environments.
|
|
53
|
+
import './vendor-environments.37f266a9.js';
|
|
54
|
+
import './vendor-index.0b5b3600.js';
|
|
55
|
+
import 'node:assert';
|
|
53
56
|
import 'node:console';
|
|
54
57
|
import 'node:readline';
|
|
55
58
|
import 'readline';
|
package/dist/{chunk-integrations-globals.877c84db.js → chunk-integrations-globals.522ae1ae.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
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.b5efbd68.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import './vendor-vi.
|
|
4
|
+
import './vendor-vi.f8055ff2.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import './vendor-index.087d1af7.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,7 +1,7 @@
|
|
|
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, d as divider } from './vendor-node.
|
|
4
|
+
import { v as version, s as startVitest, d as divider } from './vendor-node.7b1bd3c5.js';
|
|
5
5
|
import './vendor-index.087d1af7.js';
|
|
6
6
|
import { t as toArray } from './vendor-base.9c08bbd0.js';
|
|
7
7
|
import 'vite';
|
|
@@ -33,8 +33,9 @@ import '@vitest/utils';
|
|
|
33
33
|
import 'local-pkg';
|
|
34
34
|
import 'std-env';
|
|
35
35
|
import 'node:perf_hooks';
|
|
36
|
-
import './vendor-
|
|
36
|
+
import './vendor-tasks.f9d75aed.js';
|
|
37
37
|
import '@vitest/runner/utils';
|
|
38
|
+
import '@vitest/utils/source-map';
|
|
38
39
|
import 'node:module';
|
|
39
40
|
import 'node:crypto';
|
|
40
41
|
import './vendor-index.1f85e5f1.js';
|
|
@@ -49,7 +50,9 @@ import 'acorn';
|
|
|
49
50
|
import 'acorn-walk';
|
|
50
51
|
import 'magic-string';
|
|
51
52
|
import 'strip-literal';
|
|
52
|
-
import './vendor-environments.
|
|
53
|
+
import './vendor-environments.37f266a9.js';
|
|
54
|
+
import './vendor-index.0b5b3600.js';
|
|
55
|
+
import 'node:assert';
|
|
53
56
|
import 'node:console';
|
|
54
57
|
import 'node:readline';
|
|
55
58
|
import 'readline';
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 './types-
|
|
3
|
+
import { c as ResolvedCoverageOptions, U as UserConfig, d as CoverageV8Options, P as ProjectConfig } from './types-63abf2e0.js';
|
|
4
4
|
import '@vitest/snapshot';
|
|
5
5
|
import '@vitest/expect';
|
|
6
6
|
import '@vitest/runner';
|
package/dist/coverage.d.ts
CHANGED
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.b5efbd68.js';
|
|
10
10
|
import { setupCommonEnv } from './browser.js';
|
|
11
11
|
import 'chai';
|
|
12
12
|
import '@vitest/snapshot/environment';
|
|
@@ -14,7 +14,7 @@ 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.f8055ff2.js';
|
|
18
18
|
import '@vitest/runner/utils';
|
|
19
19
|
import './vendor-index.087d1af7.js';
|
|
20
20
|
import 'std-env';
|
|
@@ -22,7 +22,8 @@ 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
3
|
import './vendor-index.087d1af7.js';
|
|
4
|
-
import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.
|
|
4
|
+
import { d as globalExpect, r as resetModules, v as vi } from './vendor-vi.f8055ff2.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.b5efbd68.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
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.37f266a9.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 './types-63abf2e0.js';
|
|
5
|
+
import '@vitest/snapshot';
|
|
6
|
+
import '@vitest/expect';
|
|
7
|
+
import 'vite';
|
|
8
|
+
import '@vitest/runner';
|
|
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 './types-63abf2e0.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 './types-63abf2e0.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>;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
export { e as bench, c as createExpect, d as expect, v as vi, f as vitest } from './vendor-vi.
|
|
2
|
+
export { e as bench, c as createExpect, d as expect, v as vi, f as vitest } from './vendor-vi.f8055ff2.js';
|
|
3
3
|
export { i as isFirstRun, r as runOnce } from './vendor-run-once.3e5ef7d7.js';
|
|
4
|
-
import { d as dist } from './vendor-index.
|
|
5
|
-
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.
|
|
4
|
+
import { d as dist } from './vendor-index.b5efbd68.js';
|
|
5
|
+
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.b5efbd68.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
export { chai };
|
|
8
8
|
export { assert, should } from 'chai';
|
|
@@ -16,7 +16,8 @@ import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
|
16
16
|
import '@vitest/expect';
|
|
17
17
|
import '@vitest/snapshot';
|
|
18
18
|
import '@vitest/utils/error';
|
|
19
|
-
import './vendor-
|
|
19
|
+
import './vendor-tasks.f9d75aed.js';
|
|
20
|
+
import '@vitest/utils/source-map';
|
|
20
21
|
import 'util';
|
|
21
22
|
import './vendor-date.6e993429.js';
|
|
22
23
|
import '@vitest/spy';
|