vitest 0.33.0 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -83
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +4 -8
- package/dist/child.js +43 -29
- package/dist/{chunk-api-setup.8f785c4a.js → chunk-api-setup.644415c3.js} +13 -7
- package/dist/{chunk-install-pkg.23da664c.js → chunk-install-pkg.dd40cbef.js} +14 -13
- package/dist/{chunk-integrations-globals.0093e2ed.js → chunk-integrations-globals.877c84db.js} +7 -6
- package/dist/chunk-runtime-console.ea222ffb.js +108 -0
- package/dist/cli.js +14 -15
- package/dist/config.cjs +4 -3
- package/dist/config.d.ts +15 -19
- package/dist/config.js +4 -3
- package/dist/coverage.d.ts +3 -2
- package/dist/entry-vm.js +60 -0
- package/dist/entry.js +34 -213
- package/dist/environments.d.ts +3 -2
- package/dist/environments.js +4 -2
- package/dist/execute.js +15 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.js +8 -7
- package/dist/loader.js +6 -4
- package/dist/node.d.ts +6 -53
- package/dist/node.js +16 -19
- package/dist/runners.d.ts +3 -2
- package/dist/runners.js +6 -5
- package/dist/{types-198fd1d9.d.ts → types-3c7dbfa5.d.ts} +139 -121
- package/dist/vendor-base.9c08bbd0.js +96 -0
- package/dist/{vendor-coverage.2e41927a.js → vendor-coverage.78040316.js} +1 -2
- package/dist/vendor-date.6e993429.js +50 -0
- package/dist/{vendor-environments.392ddf08.js → vendor-environments.443ecd82.js} +199 -3
- package/dist/vendor-execute.9ab1c1a7.js +978 -0
- package/dist/{vendor-global.6795f91f.js → vendor-global.97e4527c.js} +2 -1
- package/dist/{vendor-index.23ac4e13.js → vendor-index.087d1af7.js} +2 -20
- package/dist/vendor-index.9378c9a4.js +89 -0
- package/dist/vendor-index.b271ebe4.js +92 -0
- package/dist/{vendor-index.2af39fbb.js → vendor-index.eff408fd.js} +2 -3
- package/dist/{vendor-cli-api.bf4b62a8.js → vendor-node.caa511fc.js} +539 -836
- package/dist/{vendor-rpc.ad5b08c7.js → vendor-rpc.cbd8e972.js} +7 -4
- package/dist/{vendor-run-once.1fa85ba7.js → vendor-run-once.3e5ef7d7.js} +1 -2
- package/dist/vendor-source-map.e6c1997b.js +747 -0
- package/dist/{vendor-vi.dd6706cb.js → vendor-vi.271667ef.js} +26 -59
- package/dist/vm.js +114 -0
- package/dist/worker.js +39 -27
- package/execute.d.ts +1 -0
- package/package.json +12 -9
- package/suppress-warnings.cjs +2 -0
- package/dist/vendor-execute.3576af13.js +0 -421
- package/dist/vendor-index.cc463d9e.js +0 -189
- package/dist/vendor-tasks.f9d75aed.js +0 -14
package/LICENSE.md
CHANGED
|
@@ -58,89 +58,6 @@ Repository: git+https://github.com/antfu/install-pkg.git
|
|
|
58
58
|
|
|
59
59
|
---------------------------------------
|
|
60
60
|
|
|
61
|
-
## @jridgewell/resolve-uri
|
|
62
|
-
License: MIT
|
|
63
|
-
By: Justin Ridgewell
|
|
64
|
-
Repository: https://github.com/jridgewell/resolve-uri
|
|
65
|
-
|
|
66
|
-
> Copyright 2019 Justin Ridgewell <jridgewell@google.com>
|
|
67
|
-
>
|
|
68
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
69
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
70
|
-
> in the Software without restriction, including without limitation the rights
|
|
71
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
72
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
73
|
-
> furnished to do so, subject to the following conditions:
|
|
74
|
-
>
|
|
75
|
-
> The above copyright notice and this permission notice shall be included in
|
|
76
|
-
> all copies or substantial portions of the Software.
|
|
77
|
-
>
|
|
78
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
79
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
80
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
81
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
82
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
83
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
84
|
-
> SOFTWARE.
|
|
85
|
-
|
|
86
|
-
---------------------------------------
|
|
87
|
-
|
|
88
|
-
## @jridgewell/sourcemap-codec
|
|
89
|
-
License: MIT
|
|
90
|
-
By: Rich Harris
|
|
91
|
-
Repository: git+https://github.com/jridgewell/sourcemap-codec.git
|
|
92
|
-
|
|
93
|
-
> The MIT License
|
|
94
|
-
>
|
|
95
|
-
> Copyright (c) 2015 Rich Harris
|
|
96
|
-
>
|
|
97
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
98
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
99
|
-
> in the Software without restriction, including without limitation the rights
|
|
100
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
101
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
102
|
-
> furnished to do so, subject to the following conditions:
|
|
103
|
-
>
|
|
104
|
-
> The above copyright notice and this permission notice shall be included in
|
|
105
|
-
> all copies or substantial portions of the Software.
|
|
106
|
-
>
|
|
107
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
108
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
109
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
110
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
111
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
112
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
113
|
-
> THE SOFTWARE.
|
|
114
|
-
|
|
115
|
-
---------------------------------------
|
|
116
|
-
|
|
117
|
-
## @jridgewell/trace-mapping
|
|
118
|
-
License: MIT
|
|
119
|
-
By: Justin Ridgewell
|
|
120
|
-
Repository: git+https://github.com/jridgewell/trace-mapping.git
|
|
121
|
-
|
|
122
|
-
> Copyright 2022 Justin Ridgewell <justin@ridgewell.name>
|
|
123
|
-
>
|
|
124
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
125
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
126
|
-
> in the Software without restriction, including without limitation the rights
|
|
127
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
128
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
129
|
-
> furnished to do so, subject to the following conditions:
|
|
130
|
-
>
|
|
131
|
-
> The above copyright notice and this permission notice shall be included in
|
|
132
|
-
> all copies or substantial portions of the Software.
|
|
133
|
-
>
|
|
134
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
135
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
136
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
137
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
138
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
139
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
140
|
-
> SOFTWARE.
|
|
141
|
-
|
|
142
|
-
---------------------------------------
|
|
143
|
-
|
|
144
61
|
## @nodelib/fs.scandir
|
|
145
62
|
License: MIT
|
|
146
63
|
Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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-3c7dbfa5.js';
|
|
3
3
|
import '@vitest/snapshot';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import 'vite';
|
|
6
|
+
import 'vite-node';
|
|
6
7
|
import '@vitest/runner/utils';
|
|
7
8
|
import '@vitest/utils';
|
|
8
9
|
import 'tinybench';
|
|
@@ -10,7 +11,7 @@ import 'vite-node/client';
|
|
|
10
11
|
import '@vitest/snapshot/manager';
|
|
11
12
|
import 'vite-node/server';
|
|
12
13
|
import 'node:worker_threads';
|
|
13
|
-
import '
|
|
14
|
+
import 'rollup';
|
|
14
15
|
import 'node:fs';
|
|
15
16
|
import 'chai';
|
|
16
17
|
|
package/dist/browser.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export { startTests } from '@vitest/runner';
|
|
2
2
|
import { setSafeTimers } from '@vitest/utils';
|
|
3
|
-
import { a as resetRunOnceCounter } from './vendor-run-once.
|
|
4
|
-
export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.
|
|
5
|
-
import './vendor-
|
|
6
|
-
import 'pathe';
|
|
7
|
-
import 'std-env';
|
|
8
|
-
import '@vitest/runner/utils';
|
|
9
|
-
import './vendor-global.6795f91f.js';
|
|
3
|
+
import { a as resetRunOnceCounter } from './vendor-run-once.3e5ef7d7.js';
|
|
4
|
+
export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.78040316.js';
|
|
5
|
+
import './vendor-global.97e4527c.js';
|
|
10
6
|
|
|
11
7
|
let globalSetup = false;
|
|
12
8
|
async function setupCommonEnv(config) {
|
|
@@ -17,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
17
13
|
globalSetup = true;
|
|
18
14
|
setSafeTimers();
|
|
19
15
|
if (config.globals)
|
|
20
|
-
(await import('./chunk-integrations-globals.
|
|
16
|
+
(await import('./chunk-integrations-globals.877c84db.js')).registerApiGlobally();
|
|
21
17
|
}
|
|
22
18
|
function setupDefines(defines) {
|
|
23
19
|
for (const key in defines)
|
package/dist/child.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import v8 from 'node:v8';
|
|
3
|
-
import { c as createBirpc } from './vendor-index.
|
|
3
|
+
import { c as createBirpc } from './vendor-index.b271ebe4.js';
|
|
4
4
|
import { parseRegexp } from '@vitest/utils';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { l as loadEnvironment } from './vendor-environments.443ecd82.js';
|
|
6
|
+
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.9ab1c1a7.js';
|
|
7
|
+
import { r as rpcDone, c as createSafeRpc } from './vendor-rpc.cbd8e972.js';
|
|
7
8
|
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
|
|
8
9
|
import 'node:url';
|
|
10
|
+
import 'pathe';
|
|
11
|
+
import 'local-pkg';
|
|
12
|
+
import 'node:console';
|
|
13
|
+
import 'node:vm';
|
|
9
14
|
import 'vite-node/client';
|
|
10
15
|
import 'vite-node/utils';
|
|
11
|
-
import 'pathe';
|
|
12
16
|
import '@vitest/utils/error';
|
|
13
|
-
import './vendor-global.6795f91f.js';
|
|
14
17
|
import './vendor-paths.84fc7a99.js';
|
|
18
|
+
import './vendor-global.97e4527c.js';
|
|
15
19
|
import 'node:fs';
|
|
16
|
-
import '
|
|
20
|
+
import './vendor-base.9c08bbd0.js';
|
|
21
|
+
import 'node:path';
|
|
17
22
|
import 'node:module';
|
|
23
|
+
import 'vite-node/constants';
|
|
18
24
|
|
|
19
|
-
function init(ctx) {
|
|
25
|
+
async function init(ctx) {
|
|
20
26
|
const { config } = ctx;
|
|
21
27
|
process.env.VITEST_WORKER_ID = "1";
|
|
22
28
|
process.env.VITEST_POOL_ID = "1";
|
|
@@ -25,35 +31,40 @@ function init(ctx) {
|
|
|
25
31
|
const onCancel = new Promise((resolve) => {
|
|
26
32
|
setCancel = resolve;
|
|
27
33
|
});
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
const rpc = createBirpc(
|
|
35
|
+
{
|
|
36
|
+
onCancel: setCancel
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onWorkerExit", "onCancel"],
|
|
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
|
+
const environment = await loadEnvironment(ctx.environment.name, ctx.config.root);
|
|
52
|
+
if (ctx.environment.transformMode)
|
|
53
|
+
environment.transformMode = ctx.environment.transformMode;
|
|
54
|
+
const state = {
|
|
30
55
|
ctx,
|
|
31
56
|
moduleCache,
|
|
32
57
|
config,
|
|
33
58
|
mockMap,
|
|
34
59
|
onCancel,
|
|
60
|
+
environment,
|
|
35
61
|
durations: {
|
|
36
62
|
environment: 0,
|
|
37
63
|
prepare: performance.now()
|
|
38
64
|
},
|
|
39
|
-
rpc:
|
|
40
|
-
{
|
|
41
|
-
onCancel: setCancel
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onWorkerExit", "onCancel"],
|
|
45
|
-
serialize: v8.serialize,
|
|
46
|
-
deserialize: (v) => v8.deserialize(Buffer.from(v)),
|
|
47
|
-
post(v) {
|
|
48
|
-
var _a;
|
|
49
|
-
(_a = process.send) == null ? void 0 : _a.call(process, v);
|
|
50
|
-
},
|
|
51
|
-
on(fn) {
|
|
52
|
-
process.on("message", fn);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
)
|
|
65
|
+
rpc: createSafeRpc(rpc)
|
|
56
66
|
};
|
|
67
|
+
globalThis.__vitest_worker__ = state;
|
|
57
68
|
if (ctx.invalidates) {
|
|
58
69
|
ctx.invalidates.forEach((fsPath) => {
|
|
59
70
|
moduleCache.delete(fsPath);
|
|
@@ -61,6 +72,7 @@ function init(ctx) {
|
|
|
61
72
|
});
|
|
62
73
|
}
|
|
63
74
|
ctx.files.forEach((i) => moduleCache.delete(i));
|
|
75
|
+
return state;
|
|
64
76
|
}
|
|
65
77
|
function parsePossibleRegexp(str) {
|
|
66
78
|
const prefix = "$$vitest:";
|
|
@@ -76,9 +88,11 @@ function unwrapConfig(config) {
|
|
|
76
88
|
async function run(ctx) {
|
|
77
89
|
const inspectorCleanup = setupInspect(ctx.config);
|
|
78
90
|
try {
|
|
79
|
-
init(ctx);
|
|
80
|
-
const { run: run2, executor } = await startViteNode(
|
|
81
|
-
|
|
91
|
+
const state = await init(ctx);
|
|
92
|
+
const { run: run2, executor } = await startViteNode({
|
|
93
|
+
state
|
|
94
|
+
});
|
|
95
|
+
await run2(ctx.files, ctx.config, { environment: state.environment, options: ctx.environment.options }, executor);
|
|
82
96
|
await rpcDone();
|
|
83
97
|
} finally {
|
|
84
98
|
inspectorCleanup();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises, existsSync } from 'node:fs';
|
|
2
2
|
import { dirname } from 'pathe';
|
|
3
|
-
import { c as createBirpc
|
|
3
|
+
import { c as createBirpc } from './vendor-index.b271ebe4.js';
|
|
4
4
|
import require$$0$2 from 'stream';
|
|
5
5
|
import require$$0 from 'zlib';
|
|
6
6
|
import require$$0$1 from 'buffer';
|
|
@@ -13,11 +13,13 @@ 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.
|
|
17
|
-
import
|
|
16
|
+
import './vendor-index.087d1af7.js';
|
|
17
|
+
import '@vitest/utils';
|
|
18
|
+
import { p as parseErrorStacktrace } from './vendor-source-map.e6c1997b.js';
|
|
19
|
+
import { i as isPrimitive } from './vendor-base.9c08bbd0.js';
|
|
18
20
|
import 'std-env';
|
|
19
21
|
import '@vitest/runner/utils';
|
|
20
|
-
import './vendor-global.
|
|
22
|
+
import './vendor-global.97e4527c.js';
|
|
21
23
|
|
|
22
24
|
async function getModuleGraph(ctx, id) {
|
|
23
25
|
const graph = {};
|
|
@@ -4624,13 +4626,17 @@ class WebSocketReporter {
|
|
|
4624
4626
|
async onTaskUpdate(packs) {
|
|
4625
4627
|
if (this.clients.size === 0)
|
|
4626
4628
|
return;
|
|
4627
|
-
packs.forEach(([, result]) => {
|
|
4629
|
+
packs.forEach(([taskId, result]) => {
|
|
4628
4630
|
var _a;
|
|
4631
|
+
const project = this.ctx.getProjectByTaskId(taskId);
|
|
4632
|
+
const parserOptions = {
|
|
4633
|
+
getSourceMap: (file) => project.getBrowserSourceMapModuleById(file)
|
|
4634
|
+
};
|
|
4629
4635
|
if ((result == null ? void 0 : result.error) && !isPrimitive(result.error))
|
|
4630
|
-
result.error.stacks = parseErrorStacktrace(result.error);
|
|
4636
|
+
result.error.stacks = parseErrorStacktrace(result.error, parserOptions);
|
|
4631
4637
|
(_a = result == null ? void 0 : result.errors) == null ? void 0 : _a.forEach((error) => {
|
|
4632
4638
|
if (!isPrimitive(error))
|
|
4633
|
-
error.stacks = parseErrorStacktrace(error);
|
|
4639
|
+
error.stacks = parseErrorStacktrace(error, parserOptions);
|
|
4634
4640
|
});
|
|
4635
4641
|
});
|
|
4636
4642
|
this.clients.forEach((client) => {
|
|
@@ -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-
|
|
7
|
+
import { o as onetimeExports } from './vendor-node.caa511fc.js';
|
|
8
8
|
import require$$0 from 'os';
|
|
9
9
|
import 'node:buffer';
|
|
10
10
|
import 'node:path';
|
|
@@ -19,29 +19,28 @@ import 'buffer';
|
|
|
19
19
|
import 'stream';
|
|
20
20
|
import 'node:util';
|
|
21
21
|
import 'pathe';
|
|
22
|
+
import 'vite';
|
|
22
23
|
import './vendor-constants.538d9b49.js';
|
|
23
|
-
import './vendor-coverage.2e41927a.js';
|
|
24
|
-
import './vendor-environments.392ddf08.js';
|
|
25
|
-
import 'node:console';
|
|
26
|
-
import 'local-pkg';
|
|
27
24
|
import 'picocolors';
|
|
28
|
-
import './vendor-index.23ac4e13.js';
|
|
29
|
-
import 'std-env';
|
|
30
|
-
import '@vitest/runner/utils';
|
|
31
|
-
import '@vitest/utils';
|
|
32
|
-
import './vendor-global.6795f91f.js';
|
|
33
|
-
import 'vite';
|
|
34
25
|
import 'vite-node/utils';
|
|
35
26
|
import 'vite-node/client';
|
|
36
27
|
import '@vitest/snapshot/manager';
|
|
37
28
|
import 'vite-node/server';
|
|
29
|
+
import './vendor-index.087d1af7.js';
|
|
30
|
+
import 'std-env';
|
|
31
|
+
import '@vitest/runner/utils';
|
|
32
|
+
import '@vitest/utils';
|
|
33
|
+
import './vendor-global.97e4527c.js';
|
|
34
|
+
import './vendor-coverage.78040316.js';
|
|
38
35
|
import './vendor-paths.84fc7a99.js';
|
|
39
36
|
import 'node:v8';
|
|
40
|
-
import './vendor-index.
|
|
37
|
+
import './vendor-index.b271ebe4.js';
|
|
38
|
+
import './vendor-base.9c08bbd0.js';
|
|
41
39
|
import 'node:worker_threads';
|
|
42
40
|
import 'tinypool';
|
|
41
|
+
import 'local-pkg';
|
|
43
42
|
import 'node:perf_hooks';
|
|
44
|
-
import './vendor-
|
|
43
|
+
import './vendor-source-map.e6c1997b.js';
|
|
45
44
|
import 'node:module';
|
|
46
45
|
import 'node:crypto';
|
|
47
46
|
import 'node:fs/promises';
|
|
@@ -50,6 +49,8 @@ import 'acorn';
|
|
|
50
49
|
import 'acorn-walk';
|
|
51
50
|
import 'magic-string';
|
|
52
51
|
import 'strip-literal';
|
|
52
|
+
import './vendor-environments.443ecd82.js';
|
|
53
|
+
import 'node:console';
|
|
53
54
|
import 'node:readline';
|
|
54
55
|
import 'readline';
|
|
55
56
|
|
package/dist/{chunk-integrations-globals.0093e2ed.js → chunk-integrations-globals.877c84db.js}
RENAMED
|
@@ -1,22 +1,23 @@
|
|
|
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.eff408fd.js';
|
|
3
3
|
import '@vitest/runner';
|
|
4
|
-
import './vendor-vi.
|
|
4
|
+
import './vendor-vi.271667ef.js';
|
|
5
5
|
import '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils';
|
|
7
|
-
import './vendor-index.
|
|
7
|
+
import './vendor-index.087d1af7.js';
|
|
8
8
|
import 'pathe';
|
|
9
9
|
import 'std-env';
|
|
10
|
-
import './vendor-global.
|
|
10
|
+
import './vendor-global.97e4527c.js';
|
|
11
11
|
import 'chai';
|
|
12
12
|
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-source-map.e6c1997b.js';
|
|
17
17
|
import 'util';
|
|
18
|
+
import './vendor-date.6e993429.js';
|
|
18
19
|
import '@vitest/spy';
|
|
19
|
-
import './vendor-run-once.
|
|
20
|
+
import './vendor-run-once.3e5ef7d7.js';
|
|
20
21
|
|
|
21
22
|
function registerApiGlobally() {
|
|
22
23
|
globalApis.forEach((api) => {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Writable } from 'node:stream';
|
|
2
|
+
import { Console } from 'node:console';
|
|
3
|
+
import { getSafeTimers } from '@vitest/utils';
|
|
4
|
+
import { R as RealDate } from './vendor-date.6e993429.js';
|
|
5
|
+
|
|
6
|
+
function createCustomConsole(state) {
|
|
7
|
+
const stdoutBuffer = /* @__PURE__ */ new Map();
|
|
8
|
+
const stderrBuffer = /* @__PURE__ */ new Map();
|
|
9
|
+
const timers = /* @__PURE__ */ new Map();
|
|
10
|
+
const unknownTestId = "__vitest__unknown_test__";
|
|
11
|
+
const { setTimeout, clearTimeout } = getSafeTimers();
|
|
12
|
+
function schedule(taskId) {
|
|
13
|
+
const timer = timers.get(taskId);
|
|
14
|
+
const { stdoutTime, stderrTime } = timer;
|
|
15
|
+
clearTimeout(timer.timer);
|
|
16
|
+
timer.timer = setTimeout(() => {
|
|
17
|
+
if (stderrTime < stdoutTime) {
|
|
18
|
+
sendStderr(taskId);
|
|
19
|
+
sendStdout(taskId);
|
|
20
|
+
} else {
|
|
21
|
+
sendStdout(taskId);
|
|
22
|
+
sendStderr(taskId);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function sendStdout(taskId) {
|
|
27
|
+
const buffer = stdoutBuffer.get(taskId);
|
|
28
|
+
if (!buffer)
|
|
29
|
+
return;
|
|
30
|
+
const content = buffer.map((i) => String(i)).join("");
|
|
31
|
+
const timer = timers.get(taskId);
|
|
32
|
+
state.rpc.onUserConsoleLog({
|
|
33
|
+
type: "stdout",
|
|
34
|
+
content: content || "<empty line>",
|
|
35
|
+
taskId,
|
|
36
|
+
time: timer.stdoutTime || RealDate.now(),
|
|
37
|
+
size: buffer.length
|
|
38
|
+
});
|
|
39
|
+
stdoutBuffer.set(taskId, []);
|
|
40
|
+
timer.stdoutTime = 0;
|
|
41
|
+
}
|
|
42
|
+
function sendStderr(taskId) {
|
|
43
|
+
const buffer = stderrBuffer.get(taskId);
|
|
44
|
+
if (!buffer)
|
|
45
|
+
return;
|
|
46
|
+
const content = buffer.map((i) => String(i)).join("");
|
|
47
|
+
const timer = timers.get(taskId);
|
|
48
|
+
state.rpc.onUserConsoleLog({
|
|
49
|
+
type: "stderr",
|
|
50
|
+
content: content || "<empty line>",
|
|
51
|
+
taskId,
|
|
52
|
+
time: timer.stderrTime || RealDate.now(),
|
|
53
|
+
size: buffer.length
|
|
54
|
+
});
|
|
55
|
+
stderrBuffer.set(taskId, []);
|
|
56
|
+
timer.stderrTime = 0;
|
|
57
|
+
}
|
|
58
|
+
const stdout = new Writable({
|
|
59
|
+
write(data, encoding, callback) {
|
|
60
|
+
var _a;
|
|
61
|
+
const id = ((_a = state == null ? void 0 : state.current) == null ? void 0 : _a.id) ?? unknownTestId;
|
|
62
|
+
let timer = timers.get(id);
|
|
63
|
+
if (timer) {
|
|
64
|
+
timer.stdoutTime = timer.stdoutTime || RealDate.now();
|
|
65
|
+
} else {
|
|
66
|
+
timer = { stdoutTime: RealDate.now(), stderrTime: RealDate.now(), timer: 0 };
|
|
67
|
+
timers.set(id, timer);
|
|
68
|
+
}
|
|
69
|
+
let buffer = stdoutBuffer.get(id);
|
|
70
|
+
if (!buffer) {
|
|
71
|
+
buffer = [];
|
|
72
|
+
stdoutBuffer.set(id, buffer);
|
|
73
|
+
}
|
|
74
|
+
buffer.push(data);
|
|
75
|
+
schedule(id);
|
|
76
|
+
callback();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const stderr = new Writable({
|
|
80
|
+
write(data, encoding, callback) {
|
|
81
|
+
var _a;
|
|
82
|
+
const id = ((_a = state == null ? void 0 : state.current) == null ? void 0 : _a.id) ?? unknownTestId;
|
|
83
|
+
let timer = timers.get(id);
|
|
84
|
+
if (timer) {
|
|
85
|
+
timer.stderrTime = timer.stderrTime || RealDate.now();
|
|
86
|
+
} else {
|
|
87
|
+
timer = { stderrTime: RealDate.now(), stdoutTime: RealDate.now(), timer: 0 };
|
|
88
|
+
timers.set(id, timer);
|
|
89
|
+
}
|
|
90
|
+
let buffer = stderrBuffer.get(id);
|
|
91
|
+
if (!buffer) {
|
|
92
|
+
buffer = [];
|
|
93
|
+
stderrBuffer.set(id, buffer);
|
|
94
|
+
}
|
|
95
|
+
buffer.push(data);
|
|
96
|
+
schedule(id);
|
|
97
|
+
callback();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return new Console({
|
|
101
|
+
stdout,
|
|
102
|
+
stderr,
|
|
103
|
+
colorMode: true,
|
|
104
|
+
groupIndentation: 2
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { createCustomConsole };
|
package/dist/cli.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
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-
|
|
5
|
-
import './vendor-index.
|
|
6
|
-
import { t as toArray } from './vendor-
|
|
7
|
-
import './vendor-constants.538d9b49.js';
|
|
8
|
-
import './vendor-coverage.2e41927a.js';
|
|
9
|
-
import './vendor-environments.392ddf08.js';
|
|
10
|
-
import 'node:console';
|
|
11
|
-
import 'local-pkg';
|
|
12
|
-
import 'node:url';
|
|
13
|
-
import 'std-env';
|
|
4
|
+
import { v as version, s as startVitest, d as divider } from './vendor-node.caa511fc.js';
|
|
5
|
+
import './vendor-index.087d1af7.js';
|
|
6
|
+
import { t as toArray } from './vendor-base.9c08bbd0.js';
|
|
14
7
|
import 'vite';
|
|
15
8
|
import 'node:path';
|
|
9
|
+
import 'node:url';
|
|
16
10
|
import 'node:process';
|
|
17
11
|
import 'node:fs';
|
|
12
|
+
import './vendor-constants.538d9b49.js';
|
|
18
13
|
import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
19
14
|
import 'os';
|
|
20
15
|
import 'path';
|
|
@@ -26,15 +21,19 @@ import 'vite-node/utils';
|
|
|
26
21
|
import 'vite-node/client';
|
|
27
22
|
import '@vitest/snapshot/manager';
|
|
28
23
|
import 'vite-node/server';
|
|
24
|
+
import './vendor-coverage.78040316.js';
|
|
29
25
|
import './vendor-paths.84fc7a99.js';
|
|
30
26
|
import 'node:v8';
|
|
31
27
|
import 'node:child_process';
|
|
28
|
+
import './vendor-index.b271ebe4.js';
|
|
32
29
|
import 'node:worker_threads';
|
|
33
30
|
import 'node:os';
|
|
34
31
|
import 'tinypool';
|
|
35
32
|
import '@vitest/utils';
|
|
33
|
+
import 'local-pkg';
|
|
34
|
+
import 'std-env';
|
|
36
35
|
import 'node:perf_hooks';
|
|
37
|
-
import './vendor-
|
|
36
|
+
import './vendor-source-map.e6c1997b.js';
|
|
38
37
|
import '@vitest/runner/utils';
|
|
39
38
|
import 'node:module';
|
|
40
39
|
import 'node:crypto';
|
|
@@ -50,12 +49,14 @@ import 'acorn';
|
|
|
50
49
|
import 'acorn-walk';
|
|
51
50
|
import 'magic-string';
|
|
52
51
|
import 'strip-literal';
|
|
52
|
+
import './vendor-environments.443ecd82.js';
|
|
53
|
+
import 'node:console';
|
|
53
54
|
import 'node:readline';
|
|
54
55
|
import 'readline';
|
|
55
|
-
import './vendor-global.
|
|
56
|
+
import './vendor-global.97e4527c.js';
|
|
56
57
|
|
|
57
58
|
const cli = cac("vitest");
|
|
58
|
-
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("--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();
|
|
59
|
+
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();
|
|
59
60
|
cli.command("run [...filters]").action(run);
|
|
60
61
|
cli.command("related [...filters]").action(runRelated);
|
|
61
62
|
cli.command("watch [...filters]").action(watch);
|
|
@@ -122,8 +123,6 @@ function normalizeCliOptions(argv) {
|
|
|
122
123
|
coverage.include = toArray(coverage.include);
|
|
123
124
|
if (coverage.ignoreClassMethods)
|
|
124
125
|
coverage.ignoreClassMethods = toArray(coverage.ignoreClassMethods);
|
|
125
|
-
if (coverage.src)
|
|
126
|
-
coverage.src = toArray(coverage.src);
|
|
127
126
|
}
|
|
128
127
|
return argv;
|
|
129
128
|
}
|
package/dist/config.cjs
CHANGED
|
@@ -13,6 +13,9 @@ const defaultCoverageExcludes = [
|
|
|
13
13
|
"dist/**",
|
|
14
14
|
"packages/*/test?(s)/**",
|
|
15
15
|
"**/*.d.ts",
|
|
16
|
+
"**/virtual:*",
|
|
17
|
+
"**/__x00__*",
|
|
18
|
+
"**/\0*",
|
|
16
19
|
"cypress/**",
|
|
17
20
|
"test?(s)/**",
|
|
18
21
|
"test?(-*).?(c|m)[jt]s?(x)",
|
|
@@ -28,10 +31,8 @@ const coverageConfigDefaults = {
|
|
|
28
31
|
cleanOnRerun: true,
|
|
29
32
|
reportsDirectory: "./coverage",
|
|
30
33
|
exclude: defaultCoverageExcludes,
|
|
31
|
-
reportOnFailure:
|
|
34
|
+
reportOnFailure: false,
|
|
32
35
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
33
|
-
// default extensions used by c8, plus '.vue' and '.svelte'
|
|
34
|
-
// see https://github.com/istanbuljs/schema/blob/master/default-extension.js
|
|
35
36
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
36
37
|
};
|
|
37
38
|
const fakeTimersDefaults = {
|