vitest 0.29.8 → 0.30.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 +372 -451
- 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.c93e5069.js} +58 -51
- package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.ee5cc9a8.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 +18 -4
- package/dist/config.js +10 -1
- package/dist/coverage.d.ts +5 -2
- package/dist/coverage.js +6 -0
- package/dist/entry.js +35 -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 +35 -31
- package/dist/{types-94cfe4b4.d.ts → types-e3c9754d.d.ts} +224 -305
- package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.70680cd5.js} +3849 -3330
- package/dist/vendor-constants.538d9b49.js +54 -0
- package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.70609f6f.js} +9 -12
- package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
- package/dist/vendor-index.7dcbfa46.js +167 -0
- 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 +14 -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-base.b5ddfcc9.js +0 -91
- 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.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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';
|
|
8
|
+
import { performance } from 'node:perf_hooks';
|
|
6
9
|
import { updateTask } from '@vitest/runner';
|
|
7
10
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
8
|
-
import '@vitest/runner/utils';
|
|
9
11
|
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';
|
|
12
|
+
import './vendor-_commonjsHelpers.76cdd49e.js';
|
|
13
|
+
import '@vitest/snapshot';
|
|
15
14
|
import 'util';
|
|
16
15
|
import '@vitest/spy';
|
|
16
|
+
import 'pathe';
|
|
17
17
|
import 'std-env';
|
|
18
18
|
|
|
19
19
|
class VitestTestRunner {
|
|
@@ -31,7 +31,9 @@ class VitestTestRunner {
|
|
|
31
31
|
this.snapshotClient.clear();
|
|
32
32
|
}
|
|
33
33
|
async onAfterRun() {
|
|
34
|
-
await this.snapshotClient.
|
|
34
|
+
const result = await this.snapshotClient.resetCurrent();
|
|
35
|
+
if (result)
|
|
36
|
+
await rpc().snapshotSaved(result);
|
|
35
37
|
}
|
|
36
38
|
onAfterRunSuite(suite) {
|
|
37
39
|
if (this.config.logHeapUsage && typeof process !== "undefined")
|
|
@@ -44,12 +46,13 @@ class VitestTestRunner {
|
|
|
44
46
|
this.workerState.current = void 0;
|
|
45
47
|
}
|
|
46
48
|
async onBeforeRunTest(test) {
|
|
49
|
+
const name = getNames(test).slice(1).join(" > ");
|
|
47
50
|
if (test.mode !== "run") {
|
|
48
|
-
this.snapshotClient.skipTestSnapshots(
|
|
51
|
+
this.snapshotClient.skipTestSnapshots(name);
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
54
|
clearModuleMocks(this.config);
|
|
52
|
-
await this.snapshotClient.setTest(test);
|
|
55
|
+
await this.snapshotClient.setTest(test.file.filepath, name, this.workerState.config.snapshotOptions);
|
|
53
56
|
this.workerState.current = test;
|
|
54
57
|
}
|
|
55
58
|
onBeforeTryTest(test) {
|
|
@@ -72,6 +75,7 @@ class VitestTestRunner {
|
|
|
72
75
|
expectedAssertionsNumberErrorGen,
|
|
73
76
|
isExpectingAssertions,
|
|
74
77
|
isExpectingAssertionsError
|
|
78
|
+
// @ts-expect-error local is untyped
|
|
75
79
|
} = test.context._local ? test.context.expect.getState() : getState(globalThis[GLOBAL_EXPECT]);
|
|
76
80
|
if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
|
|
77
81
|
throw expectedAssertionsNumberErrorGen();
|
|
@@ -111,7 +115,7 @@ function clearModuleMocks(config) {
|
|
|
111
115
|
|
|
112
116
|
async function importTinybench() {
|
|
113
117
|
if (!globalThis.EventTarget)
|
|
114
|
-
await import('./vendor-index.
|
|
118
|
+
await import('./vendor-index.fc98d30f.js').then(function (n) { return n.i; });
|
|
115
119
|
return await import('tinybench');
|
|
116
120
|
}
|
|
117
121
|
function createBenchmarkResult(name) {
|
|
@@ -179,27 +183,27 @@ async function runBenchmarkSuite(suite, runner) {
|
|
|
179
183
|
defer.reject(_benchmark ? task.result.error : e);
|
|
180
184
|
});
|
|
181
185
|
});
|
|
182
|
-
|
|
186
|
+
const tasks = [];
|
|
187
|
+
for (const benchmark of benchmarkGroup) {
|
|
183
188
|
await benchmark.meta.task.warmup();
|
|
184
189
|
const { setTimeout } = getSafeTimers();
|
|
185
|
-
|
|
190
|
+
tasks.push(await new Promise((resolve) => setTimeout(async () => {
|
|
186
191
|
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);
|
|
192
|
+
})));
|
|
193
|
+
}
|
|
194
|
+
suite.result.duration = performance.now() - start;
|
|
195
|
+
suite.result.state = "pass";
|
|
196
|
+
tasks.sort((a, b) => a.result.mean - b.result.mean).forEach((cycle, idx) => {
|
|
197
|
+
const benchmark = benchmarkMap[cycle.name || ""];
|
|
198
|
+
benchmark.result.state = "pass";
|
|
199
|
+
if (benchmark) {
|
|
200
|
+
const result = benchmark.result.benchmark;
|
|
201
|
+
result.rank = Number(idx) + 1;
|
|
202
|
+
updateTask$1(benchmark);
|
|
203
|
+
}
|
|
202
204
|
});
|
|
205
|
+
updateTask$1(suite);
|
|
206
|
+
defer.resolve(null);
|
|
203
207
|
await defer;
|
|
204
208
|
}
|
|
205
209
|
function updateTask$1(task) {
|