vitest 0.29.8 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -81
- package/dist/browser.d.ts +5 -3
- package/dist/browser.js +5 -6
- package/dist/child.js +12 -16
- package/dist/{chunk-api-setup.3aabe9ac.js → chunk-api-setup.6662587e.js} +53 -48
- package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.6450b372.js} +32 -32
- package/dist/chunk-integrations-globals.d419838f.js +26 -0
- package/dist/{chunk-node-git.ed5bded8.js → chunk-node-git.4c43bd73.js} +4 -2
- package/dist/cli-wrapper.js +6 -5
- package/dist/cli.js +26 -26
- package/dist/config.cjs +15 -2
- package/dist/config.d.ts +15 -4
- package/dist/config.js +10 -1
- package/dist/coverage.d.ts +5 -2
- package/dist/coverage.js +6 -0
- package/dist/entry.js +34 -34
- package/dist/environments.d.ts +5 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +9 -11
- package/dist/loader.js +396 -13
- package/dist/node.d.ts +9 -7
- package/dist/node.js +27 -30
- package/dist/runners.d.ts +5 -2
- package/dist/runners.js +34 -31
- package/dist/{types-94cfe4b4.d.ts → types-f03c83c4.d.ts} +225 -306
- package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.c04eaa34.js} +3845 -3326
- package/dist/vendor-constants.538d9b49.js +54 -0
- package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.8eaab47b.js} +9 -12
- package/dist/{chunk-utils-base.b5ddfcc9.js → vendor-index.4f82d248.js} +80 -10
- package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
- package/dist/{chunk-integrations-utils.23c19408.js → vendor-index.81b9e499.js} +22 -21
- package/dist/{vendor-index.2cbcdd1e.js → vendor-index.c1e09929.js} +458 -373
- package/dist/vendor-index.fad2598b.js +44 -0
- package/dist/{vendor-index.534e612c.js → vendor-index.fc98d30f.js} +2 -2
- package/dist/{chunk-runtime-inspector.b1427a10.js → vendor-inspector.47fc8cbb.js} +5 -2
- package/dist/{chunk-runtime-rpc.d6aa57f8.js → vendor-rpc.4d3d7a54.js} +5 -5
- package/dist/{chunk-integrations-run-once.ea614f17.js → vendor-run-once.69ce7172.js} +3 -3
- package/dist/{chunk-runtime-setup.5d504677.js → vendor-setup.common.cef38f4e.js} +2 -2
- package/dist/vendor-tasks.042d6084.js +14 -0
- package/dist/{chunk-utils-import.e488ace3.js → vendor-vi.a3ff54b1.js} +73 -2957
- package/dist/worker.js +13 -18
- package/package.json +29 -34
- package/dist/chunk-constants.bc18a549.js +0 -36
- package/dist/chunk-integrations-globals.49802775.js +0 -28
- package/dist/chunk-snapshot-env.a347d647.js +0 -11
- package/dist/chunk-utils-env.6b856dbf.js +0 -64
- package/dist/chunk-utils-tasks.8781fd71.js +0 -107
- package/dist/env-afee91f0.d.ts +0 -10
- package/dist/vendor-index.783e7f3e.js +0 -71
- package/dist/vendor-index.bdee400f.js +0 -396
- package/dist/vendor-magic-string.es.b3bc5745.js +0 -1591
- /package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.76cdd49e.js} +0 -0
- /package/dist/{chunk-integrations-coverage.d93ee824.js → vendor-coverage.a585b712.js} +0 -0
- /package/dist/{chunk-utils-global.fd174983.js → vendor-global.6795f91f.js} +0 -0
- /package/dist/{chunk-paths.e36446b4.js → vendor-paths.84fc7a99.js} +0 -0
package/dist/runners.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, TestContext } from '@vitest/runner';
|
|
2
|
-
import { a as ResolvedConfig } from './types-
|
|
2
|
+
import { a as ResolvedConfig } from './types-f03c83c4.js';
|
|
3
3
|
import '@vitest/expect';
|
|
4
|
+
import '@vitest/snapshot';
|
|
4
5
|
import 'vite';
|
|
5
6
|
import '@vitest/runner/types';
|
|
6
7
|
import '@vitest/runner/utils';
|
|
7
8
|
import '@vitest/utils';
|
|
8
9
|
import 'tinybench';
|
|
9
10
|
import 'vite-node/client';
|
|
11
|
+
import '@vitest/snapshot/manager';
|
|
10
12
|
import 'node:worker_threads';
|
|
11
13
|
import 'vite-node';
|
|
12
14
|
import 'source-map';
|
|
13
|
-
import 'node:fs';
|
|
14
15
|
import 'vite-node/server';
|
|
16
|
+
import 'node:fs';
|
|
17
|
+
import 'chai';
|
|
15
18
|
|
|
16
19
|
declare class VitestTestRunner implements VitestRunner {
|
|
17
20
|
config: ResolvedConfig;
|
package/dist/runners.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import {
|
|
3
|
-
import './
|
|
4
|
-
import {
|
|
5
|
-
import { g as getFullName } from './
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.a3ff54b1.js';
|
|
3
|
+
import './vendor-index.fad2598b.js';
|
|
4
|
+
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
|
|
5
|
+
import { g as getFullName } from './vendor-tasks.042d6084.js';
|
|
6
|
+
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
7
|
+
import { getNames } from '@vitest/runner/utils';
|
|
6
8
|
import { updateTask } from '@vitest/runner';
|
|
7
9
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
8
|
-
import '@vitest/runner/utils';
|
|
9
10
|
import 'chai';
|
|
10
|
-
import './vendor-_commonjsHelpers.
|
|
11
|
-
import '
|
|
12
|
-
import 'pathe';
|
|
13
|
-
import './chunk-snapshot-env.a347d647.js';
|
|
14
|
-
import './chunk-utils-base.b5ddfcc9.js';
|
|
11
|
+
import './vendor-_commonjsHelpers.76cdd49e.js';
|
|
12
|
+
import '@vitest/snapshot';
|
|
15
13
|
import 'util';
|
|
16
14
|
import '@vitest/spy';
|
|
15
|
+
import 'pathe';
|
|
17
16
|
import 'std-env';
|
|
18
17
|
|
|
19
18
|
class VitestTestRunner {
|
|
@@ -31,7 +30,9 @@ class VitestTestRunner {
|
|
|
31
30
|
this.snapshotClient.clear();
|
|
32
31
|
}
|
|
33
32
|
async onAfterRun() {
|
|
34
|
-
await this.snapshotClient.
|
|
33
|
+
const result = await this.snapshotClient.resetCurrent();
|
|
34
|
+
if (result)
|
|
35
|
+
await rpc().snapshotSaved(result);
|
|
35
36
|
}
|
|
36
37
|
onAfterRunSuite(suite) {
|
|
37
38
|
if (this.config.logHeapUsage && typeof process !== "undefined")
|
|
@@ -44,12 +45,13 @@ class VitestTestRunner {
|
|
|
44
45
|
this.workerState.current = void 0;
|
|
45
46
|
}
|
|
46
47
|
async onBeforeRunTest(test) {
|
|
48
|
+
const name = getNames(test).slice(1).join(" > ");
|
|
47
49
|
if (test.mode !== "run") {
|
|
48
|
-
this.snapshotClient.skipTestSnapshots(
|
|
50
|
+
this.snapshotClient.skipTestSnapshots(name);
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
clearModuleMocks(this.config);
|
|
52
|
-
await this.snapshotClient.setTest(test);
|
|
54
|
+
await this.snapshotClient.setTest(test.file.filepath, name, this.workerState.config.snapshotOptions);
|
|
53
55
|
this.workerState.current = test;
|
|
54
56
|
}
|
|
55
57
|
onBeforeTryTest(test) {
|
|
@@ -72,6 +74,7 @@ class VitestTestRunner {
|
|
|
72
74
|
expectedAssertionsNumberErrorGen,
|
|
73
75
|
isExpectingAssertions,
|
|
74
76
|
isExpectingAssertionsError
|
|
77
|
+
// @ts-expect-error local is untyped
|
|
75
78
|
} = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
76
79
|
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
|
|
77
80
|
throw expectedAssertionsNumberErrorGen();
|
|
@@ -111,7 +114,7 @@ function clearModuleMocks(config) {
|
|
|
111
114
|
|
|
112
115
|
async function importTinybench() {
|
|
113
116
|
if (!globalThis.EventTarget)
|
|
114
|
-
await import('./vendor-index.
|
|
117
|
+
await import('./vendor-index.fc98d30f.js').then(function (n) { return n.i; });
|
|
115
118
|
return await import('tinybench');
|
|
116
119
|
}
|
|
117
120
|
function createBenchmarkResult(name) {
|
|
@@ -179,27 +182,27 @@ async function runBenchmarkSuite(suite, runner) {
|
|
|
179
182
|
defer.reject(_benchmark ? task.result.error : e);
|
|
180
183
|
});
|
|
181
184
|
});
|
|
182
|
-
|
|
185
|
+
const tasks = [];
|
|
186
|
+
for (const benchmark of benchmarkGroup) {
|
|
183
187
|
await benchmark.meta.task.warmup();
|
|
184
188
|
const { setTimeout } = getSafeTimers();
|
|
185
|
-
|
|
189
|
+
tasks.push(await new Promise((resolve) => setTimeout(async () => {
|
|
186
190
|
resolve(await benchmark.meta.task.run());
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
updateTask$1(suite);
|
|
201
|
-
defer.resolve(null);
|
|
191
|
+
})));
|
|
192
|
+
}
|
|
193
|
+
suite.result.duration = performance.now() - start;
|
|
194
|
+
suite.result.state = "pass";
|
|
195
|
+
tasks.sort((a, b) => a.result.mean - b.result.mean).forEach((cycle, idx) => {
|
|
196
|
+
const benchmark = benchmarkMap[cycle.name || ""];
|
|
197
|
+
benchmark.result.state = "pass";
|
|
198
|
+
if (benchmark) {
|
|
199
|
+
const result = benchmark.result.benchmark;
|
|
200
|
+
result.rank = Number(idx) + 1;
|
|
201
|
+
updateTask$1(benchmark);
|
|
202
|
+
}
|
|
202
203
|
});
|
|
204
|
+
updateTask$1(suite);
|
|
205
|
+
defer.resolve(null);
|
|
203
206
|
await defer;
|
|
204
207
|
}
|
|
205
208
|
function updateTask$1(task) {
|