vitest 0.23.1 → 0.23.4
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/dist/browser.d.ts +3 -3
- package/dist/browser.mjs +7 -7
- package/dist/{chunk-api-setup.9e83ca0a.mjs → chunk-api-setup.11cfd513.mjs} +5 -5
- package/dist/{chunk-constants.6196597b.mjs → chunk-constants.71e8a211.mjs} +0 -0
- package/dist/{chunk-install-pkg.e081fc1b.mjs → chunk-install-pkg.3aa3eae6.mjs} +3 -3
- package/dist/{chunk-integrations-globals.b1aa52c3.mjs → chunk-integrations-globals.d8c90af9.mjs} +6 -6
- package/dist/{chunk-mock-date.f63a5ff2.mjs → chunk-mock-date.2917be60.mjs} +2 -2
- package/dist/{chunk-node-git.6f289b0a.mjs → chunk-node-git.a44b4872.mjs} +4 -4
- package/dist/{chunk-runtime-chain.8bfc559b.mjs → chunk-runtime-chain.0ab05798.mjs} +13 -25
- package/dist/{chunk-runtime-error.252dd130.mjs → chunk-runtime-error.f5506f40.mjs} +45 -30
- package/dist/{chunk-runtime-hooks.c6b06bd8.mjs → chunk-runtime-hooks.e4219ed5.mjs} +3 -3
- package/dist/{chunk-runtime-mocker.d9690273.mjs → chunk-runtime-mocker.4bbb070f.mjs} +19 -9
- package/dist/{chunk-runtime-rpc.48bd94e3.mjs → chunk-runtime-rpc.00a890d2.mjs} +1 -1
- package/dist/{chunk-utils-source-map.a1647f5f.mjs → chunk-utils-source-map.2be5aa48.mjs} +2 -2
- package/dist/{chunk-vite-node-client.998e04d0.mjs → chunk-vite-node-client.da0a17ff.mjs} +2 -2
- package/dist/{chunk-vite-node-debug.2d8a1dc3.mjs → chunk-vite-node-debug.536c4c5b.mjs} +1 -1
- package/dist/{chunk-vite-node-externalize.3035bd5b.mjs → chunk-vite-node-externalize.8d8032d0.mjs} +1192 -1101
- package/dist/{chunk-vite-node-utils.8a9b3014.mjs → chunk-vite-node-utils.473cd0b2.mjs} +1 -1
- package/dist/cli-wrapper.mjs +7 -5
- package/dist/cli.mjs +9 -9
- package/dist/config.d.ts +1 -1
- package/dist/entry.mjs +7 -7
- package/dist/environments.d.ts +1 -1
- package/dist/{global-ea084c9f.d.ts → global-e98f203b.d.ts} +22 -5
- package/dist/{index-5f09f4d0.d.ts → index-6e18a03a.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +6 -6
- package/dist/loader.mjs +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.mjs +9 -9
- package/dist/suite.mjs +5 -5
- package/dist/{vendor-index.731a22f2.mjs → vendor-index.29636037.mjs} +0 -0
- package/dist/{vendor-index.62ce5c33.mjs → vendor-index.2ae8040a.mjs} +0 -0
- package/dist/{vendor-index.13e3bda3.mjs → vendor-index.9d9196cc.mjs} +0 -0
- package/dist/{vendor-index.4aeeb598.mjs → vendor-index.fbec8a81.mjs} +2 -2
- package/dist/worker.mjs +6 -6
- package/package.json +12 -12
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-
|
|
2
|
-
import { R as ResolvedConfig } from './global-
|
|
3
|
-
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-
|
|
1
|
+
export { E as EnhancedSpy, r as Mock, u as MockContext, q as MockInstance, v as Mocked, w as MockedClass, o as MockedFunction, p as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, i as it, d as suite, t as test } from './index-6e18a03a.js';
|
|
2
|
+
import { R as ResolvedConfig } from './global-e98f203b.js';
|
|
3
|
+
export { L as AfterSuiteRunMeta, A as ApiConfig, Y as ArgumentsType, X as Arrayable, P as Awaitable, ae as BaseCoverageOptions, ak as BenchFunction, ai as Benchmark, al as BenchmarkAPI, aj as BenchmarkResult, ah as BenchmarkUserOptions, B as BuiltinEnvironment, C as CSSModuleScopeStrategy, a0 as Constructable, ag as CoverageC8Options, af as CoverageIstanbulOptions, ac as CoverageOptions, a9 as CoverageProvider, aa as CoverageProviderModule, ab as CoverageReporter, _ as DeepMerge, D as DoneCallback, a3 as Environment, E as EnvironmentOptions, a2 as EnvironmentReturn, a7 as ErrorWithDiff, a as File, n as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, Z as MergeInsertions, a1 as ModuleCache, M as ModuleGraphData, $ as MutableArray, Q as Nullable, a8 as OnServerRestartHandler, a6 as ParsedStack, a5 as Position, b as Reporter, K as ResolveIdFunction, R as ResolvedConfig, ad as ResolvedCoverageOptions, d as RunMode, r as RuntimeContext, u as SnapshotData, x as SnapshotMatchOptions, y as SnapshotResult, w as SnapshotStateOptions, G as SnapshotSummary, v as SnapshotUpdateState, S as Suite, m as SuiteAPI, p as SuiteCollector, q as SuiteFactory, o as SuiteHooks, i as Task, f as TaskBase, g as TaskResult, T as TaskResultPack, e as TaskState, h as Test, l as TestAPI, s as TestContext, j as TestFunction, k as TestOptions, z as UncheckedSnapshot, U as UserConfig, a4 as UserConsoleLog, t as Vitest, V as VitestEnvironment, c as VitestRunMode, W as WorkerContext, O as WorkerGlobalState, N as WorkerRPC } from './global-e98f203b.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/browser.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.
|
|
3
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.0ab05798.mjs';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach } from './chunk-runtime-hooks.e4219ed5.mjs';
|
|
3
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-error.f5506f40.mjs';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-mock-date.
|
|
8
|
+
import './chunk-mock-date.2917be60.mjs';
|
|
9
9
|
import 'path';
|
|
10
|
-
import './chunk-constants.
|
|
10
|
+
import './chunk-constants.71e8a211.mjs';
|
|
11
11
|
import 'tty';
|
|
12
12
|
import 'url';
|
|
13
13
|
import 'local-pkg';
|
|
14
14
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
15
|
-
import './chunk-runtime-rpc.
|
|
15
|
+
import './chunk-runtime-rpc.00a890d2.mjs';
|
|
16
16
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
17
17
|
import 'fs';
|
|
18
|
-
import './chunk-utils-source-map.
|
|
18
|
+
import './chunk-utils-source-map.2be5aa48.mjs';
|
|
19
19
|
import './spy.mjs';
|
|
20
20
|
import 'tinyspy';
|
|
21
21
|
import 'perf_hooks';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import { c as createBirpc } from './chunk-vite-node-client.
|
|
2
|
+
import { c as createBirpc } from './chunk-vite-node-client.da0a17ff.mjs';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,17 +9,17 @@ import require$$2 from 'events';
|
|
|
9
9
|
import require$$1 from 'https';
|
|
10
10
|
import require$$2$1 from 'http';
|
|
11
11
|
import url from 'url';
|
|
12
|
-
import { A as API_PATH } from './chunk-constants.
|
|
13
|
-
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.
|
|
12
|
+
import { A as API_PATH } from './chunk-constants.71e8a211.mjs';
|
|
13
|
+
import { i as interpretSourcePos, p as parseStacktrace } from './chunk-utils-source-map.2be5aa48.mjs';
|
|
14
14
|
import 'module';
|
|
15
15
|
import 'vm';
|
|
16
|
-
import './chunk-vite-node-utils.
|
|
16
|
+
import './chunk-vite-node-utils.473cd0b2.mjs';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'assert';
|
|
19
19
|
import 'util';
|
|
20
20
|
import 'debug';
|
|
21
21
|
import 'tty';
|
|
22
|
-
import './chunk-mock-date.
|
|
22
|
+
import './chunk-mock-date.2917be60.mjs';
|
|
23
23
|
import 'local-pkg';
|
|
24
24
|
|
|
25
25
|
/*! (c) 2020 Andrea Giammarchi */
|
|
File without changes
|
|
@@ -2,10 +2,10 @@ import path$2 from 'path';
|
|
|
2
2
|
import fs$2 from 'fs';
|
|
3
3
|
import util from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
|
-
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.
|
|
6
|
-
import { o as onetime$1 } from './vendor-index.
|
|
5
|
+
import { p as pathKey, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.2ae8040a.mjs';
|
|
6
|
+
import { o as onetime$1 } from './vendor-index.9d9196cc.mjs';
|
|
7
7
|
import require$$0 from 'os';
|
|
8
|
-
import { s as signalExit } from './vendor-index.
|
|
8
|
+
import { s as signalExit } from './vendor-index.29636037.mjs';
|
|
9
9
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
10
10
|
import 'buffer';
|
|
11
11
|
import 'stream';
|
package/dist/{chunk-integrations-globals.b1aa52c3.mjs → chunk-integrations-globals.d8c90af9.mjs}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { k as globalApis } from './chunk-constants.
|
|
2
|
-
import { i as index } from './chunk-runtime-hooks.
|
|
1
|
+
import { k as globalApis } from './chunk-constants.71e8a211.mjs';
|
|
2
|
+
import { i as index } from './chunk-runtime-hooks.e4219ed5.mjs';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
|
-
import './chunk-runtime-chain.
|
|
6
|
+
import './chunk-runtime-chain.0ab05798.mjs';
|
|
7
7
|
import 'util';
|
|
8
|
-
import './chunk-mock-date.
|
|
8
|
+
import './chunk-mock-date.2917be60.mjs';
|
|
9
9
|
import 'local-pkg';
|
|
10
10
|
import 'chai';
|
|
11
11
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
12
|
-
import './chunk-runtime-rpc.
|
|
12
|
+
import './chunk-runtime-rpc.00a890d2.mjs';
|
|
13
13
|
import './chunk-utils-timers.b48455ed.mjs';
|
|
14
14
|
import 'fs';
|
|
15
|
-
import './chunk-utils-source-map.
|
|
15
|
+
import './chunk-utils-source-map.2be5aa48.mjs';
|
|
16
16
|
import './spy.mjs';
|
|
17
17
|
import 'tinyspy';
|
|
18
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relative } from 'path';
|
|
2
|
-
import { r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-constants.
|
|
2
|
+
import { r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-constants.71e8a211.mjs';
|
|
3
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
4
|
|
|
5
5
|
const RealDate = Date;
|
|
@@ -273,7 +273,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
273
273
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
274
274
|
});
|
|
275
275
|
if (install) {
|
|
276
|
-
await (await import('./chunk-install-pkg.
|
|
276
|
+
await (await import('./chunk-install-pkg.3aa3eae6.mjs')).installPackage(dependency, { dev: true });
|
|
277
277
|
process.stderr.write(picocolors.exports.yellow(`
|
|
278
278
|
Package ${dependency} installed, re-run the command to start.
|
|
279
279
|
`));
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as resolve } from './chunk-constants.
|
|
2
|
-
import { e as execa } from './vendor-index.
|
|
1
|
+
import { a as resolve } from './chunk-constants.71e8a211.mjs';
|
|
2
|
+
import { e as execa } from './vendor-index.fbec8a81.mjs';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|
|
6
6
|
import 'buffer';
|
|
7
7
|
import 'child_process';
|
|
8
8
|
import 'process';
|
|
9
|
-
import './vendor-index.
|
|
9
|
+
import './vendor-index.2ae8040a.mjs';
|
|
10
10
|
import './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
11
11
|
import 'fs';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'util';
|
|
14
14
|
import 'os';
|
|
15
|
-
import './vendor-index.
|
|
15
|
+
import './vendor-index.29636037.mjs';
|
|
16
16
|
import 'assert';
|
|
17
17
|
import 'events';
|
|
18
18
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
|
-
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, f as isRunningInTest, n as noop, h as isRunningInBenchmark } from './chunk-mock-date.
|
|
2
|
+
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, f as isRunningInTest, n as noop, h as isRunningInBenchmark } from './chunk-mock-date.2917be60.mjs';
|
|
3
3
|
import * as chai$2 from 'chai';
|
|
4
4
|
import { expect, AssertionError, util } from 'chai';
|
|
5
5
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.00a890d2.mjs';
|
|
7
7
|
import fs, { promises } from 'fs';
|
|
8
|
-
import { j as join, d as dirname, p as picocolors } from './chunk-constants.
|
|
9
|
-
import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.
|
|
8
|
+
import { j as join, d as dirname, p as picocolors } from './chunk-constants.71e8a211.mjs';
|
|
9
|
+
import { a as plugins_1, f as format_1, g as getOriginalPos, b as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.2be5aa48.mjs';
|
|
10
10
|
import { isMockFunction } from './spy.mjs';
|
|
11
11
|
import { s as safeSetTimeout, a as safeClearTimeout } from './chunk-utils-timers.b48455ed.mjs';
|
|
12
12
|
|
|
@@ -2164,7 +2164,6 @@ If this is a long-running test, pass a timeout value as the last argument or con
|
|
|
2164
2164
|
|
|
2165
2165
|
const fnMap = /* @__PURE__ */ new WeakMap();
|
|
2166
2166
|
const hooksMap = /* @__PURE__ */ new WeakMap();
|
|
2167
|
-
const benchmarkMap = /* @__PURE__ */ new WeakMap();
|
|
2168
2167
|
function setFn(key, fn) {
|
|
2169
2168
|
fnMap.set(key, fn);
|
|
2170
2169
|
}
|
|
@@ -2177,17 +2176,6 @@ function setHooks(key, hooks) {
|
|
|
2177
2176
|
function getHooks(key) {
|
|
2178
2177
|
return hooksMap.get(key);
|
|
2179
2178
|
}
|
|
2180
|
-
async function getBenchmarkFactory(key) {
|
|
2181
|
-
let benchmark = benchmarkMap.get(key);
|
|
2182
|
-
if (!benchmark) {
|
|
2183
|
-
if (!globalThis.EventTarget)
|
|
2184
|
-
await import('./vendor-index.0557b03a.mjs').then(function (n) { return n.i; });
|
|
2185
|
-
const Bench = (await import('tinybench')).default;
|
|
2186
|
-
benchmark = new Bench({});
|
|
2187
|
-
benchmarkMap.set(key, benchmark);
|
|
2188
|
-
}
|
|
2189
|
-
return benchmark;
|
|
2190
|
-
}
|
|
2191
2179
|
|
|
2192
2180
|
const suite = createSuite();
|
|
2193
2181
|
const test = createTest(
|
|
@@ -2234,12 +2222,12 @@ function createSuiteHooks() {
|
|
|
2234
2222
|
};
|
|
2235
2223
|
}
|
|
2236
2224
|
function createSuiteCollector(name, factory = () => {
|
|
2237
|
-
}, mode, concurrent, shuffle) {
|
|
2225
|
+
}, mode, concurrent, shuffle, suiteOptions) {
|
|
2238
2226
|
const tasks = [];
|
|
2239
2227
|
const factoryQueue = [];
|
|
2240
2228
|
let suite2;
|
|
2241
2229
|
initSuite();
|
|
2242
|
-
const test2 = createTest(function(name2, fn = noop, options) {
|
|
2230
|
+
const test2 = createTest(function(name2, fn = noop, options = suiteOptions) {
|
|
2243
2231
|
if (!isRunningInTest())
|
|
2244
2232
|
throw new Error("`test()` and `it()` is only available in test mode.");
|
|
2245
2233
|
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
@@ -2270,7 +2258,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
2270
2258
|
tasks.push(test3);
|
|
2271
2259
|
});
|
|
2272
2260
|
const benchmark = createBenchmark(function(name2, fn = noop, options) {
|
|
2273
|
-
const mode2 = this.skip ? "skip" : "run";
|
|
2261
|
+
const mode2 = this.only ? "only" : this.skip ? "skip" : "run";
|
|
2274
2262
|
if (!isRunningInBenchmark())
|
|
2275
2263
|
throw new Error("`bench()` is only available in benchmark mode. Run with `vitest bench` instead.");
|
|
2276
2264
|
const benchmark2 = {
|
|
@@ -2334,16 +2322,16 @@ function createSuiteCollector(name, factory = () => {
|
|
|
2334
2322
|
return collector;
|
|
2335
2323
|
}
|
|
2336
2324
|
function createSuite() {
|
|
2337
|
-
function suiteFn(name, factory) {
|
|
2325
|
+
function suiteFn(name, factory, options) {
|
|
2338
2326
|
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
2339
|
-
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle);
|
|
2327
|
+
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, options);
|
|
2340
2328
|
}
|
|
2341
2329
|
suiteFn.each = function(cases) {
|
|
2342
2330
|
const suite2 = this.withContext();
|
|
2343
|
-
return (name, fn) => {
|
|
2331
|
+
return (name, fn, options) => {
|
|
2344
2332
|
cases.forEach((i, idx) => {
|
|
2345
2333
|
const items = Array.isArray(i) ? i : [i];
|
|
2346
|
-
suite2(formatTitle(name, items, idx), () => fn(...items));
|
|
2334
|
+
suite2(formatTitle(name, items, idx), () => fn(...items), options);
|
|
2347
2335
|
});
|
|
2348
2336
|
};
|
|
2349
2337
|
};
|
|
@@ -2374,7 +2362,7 @@ function createTest(fn) {
|
|
|
2374
2362
|
}
|
|
2375
2363
|
function createBenchmark(fn) {
|
|
2376
2364
|
const benchmark = createChainable(
|
|
2377
|
-
["skip"],
|
|
2365
|
+
["skip", "only"],
|
|
2378
2366
|
fn
|
|
2379
2367
|
);
|
|
2380
2368
|
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
|
|
@@ -2382,4 +2370,4 @@ function createBenchmark(fn) {
|
|
|
2382
2370
|
return benchmark;
|
|
2383
2371
|
}
|
|
2384
2372
|
|
|
2385
|
-
export { GLOBAL_EXPECT as G, getDefaultHookTimeout as a, bench as b, createExpect as c, describe as d, globalExpect as e, clearCollectorContext as f, getCurrentSuite as g, defaultSuite as h, it as i, setHooks as j, getHooks as k, collectorContext as l,
|
|
2373
|
+
export { GLOBAL_EXPECT as G, getDefaultHookTimeout as a, bench as b, createExpect as c, describe as d, globalExpect as e, clearCollectorContext as f, getCurrentSuite as g, defaultSuite as h, it as i, setHooks as j, getHooks as k, collectorContext as l, getFn as m, setState as n, getState as o, createSuiteHooks as p, chai$1 as q, suite as s, test as t, withTimeout as w };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.99c020eb.mjs';
|
|
3
|
-
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.
|
|
4
|
-
import { k as deepClone, l as getType, o as isNode, g as getWorkerState, R as RealDate, t as toArray, p as relativePath, q as isBrowser, h as isRunningInBenchmark, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, y as createDefer, e as getFullName } from './chunk-mock-date.
|
|
5
|
-
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
3
|
+
import { r as resetRunOnceCounter, i as index, v as vi } from './chunk-runtime-hooks.e4219ed5.mjs';
|
|
4
|
+
import { k as deepClone, l as getType, o as isNode, g as getWorkerState, R as RealDate, t as toArray, p as relativePath, q as isBrowser, h as isRunningInBenchmark, u as partitionSuiteChildren, v as shuffle, w as hasTests, x as hasFailed, y as createDefer, e as getFullName } from './chunk-mock-date.2917be60.mjs';
|
|
5
|
+
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getFn, n as setState, G as GLOBAL_EXPECT, o as getState } from './chunk-runtime-chain.0ab05798.mjs';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.00a890d2.mjs';
|
|
7
7
|
import util$1 from 'util';
|
|
8
8
|
import { util } from 'chai';
|
|
9
|
-
import { s as stringify } from './chunk-utils-source-map.
|
|
9
|
+
import { s as stringify } from './chunk-utils-source-map.2be5aa48.mjs';
|
|
10
10
|
import { e as environments } from './chunk-env-node.ceb43f1c.mjs';
|
|
11
11
|
import { a as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.b48455ed.mjs';
|
|
12
12
|
|
|
@@ -154,7 +154,7 @@ async function setupGlobalEnv(config) {
|
|
|
154
154
|
if (isNode)
|
|
155
155
|
await setupConsoleLogSpy();
|
|
156
156
|
if (config.globals)
|
|
157
|
-
(await import('./chunk-integrations-globals.
|
|
157
|
+
(await import('./chunk-integrations-globals.d8c90af9.mjs')).registerApiGlobally();
|
|
158
158
|
}
|
|
159
159
|
function setupDefines(defines) {
|
|
160
160
|
for (const key in defines)
|
|
@@ -431,6 +431,11 @@ function calculateHash(parent) {
|
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
+
async function importTinybench() {
|
|
435
|
+
if (!globalThis.EventTarget)
|
|
436
|
+
await import('./vendor-index.0557b03a.mjs').then(function (n) { return n.i; });
|
|
437
|
+
return await import('tinybench');
|
|
438
|
+
}
|
|
434
439
|
const now = Date.now;
|
|
435
440
|
function updateSuiteHookState(suite, name, state) {
|
|
436
441
|
var _a;
|
|
@@ -485,7 +490,7 @@ async function sendTasksUpdate() {
|
|
|
485
490
|
async function runTest(test) {
|
|
486
491
|
var _a, _b;
|
|
487
492
|
if (test.mode !== "run") {
|
|
488
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
493
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.0ab05798.mjs').then(function (n) { return n.q; });
|
|
489
494
|
getSnapshotClient().skipTestSnapshots(test);
|
|
490
495
|
return;
|
|
491
496
|
}
|
|
@@ -501,7 +506,7 @@ async function runTest(test) {
|
|
|
501
506
|
updateTask(test);
|
|
502
507
|
clearModuleMocks();
|
|
503
508
|
if (isNode) {
|
|
504
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
509
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.0ab05798.mjs').then(function (n) { return n.q; });
|
|
505
510
|
await getSnapshotClient().setTest(test);
|
|
506
511
|
}
|
|
507
512
|
const workerState = getWorkerState();
|
|
@@ -561,7 +566,7 @@ async function runTest(test) {
|
|
|
561
566
|
if (isBrowser && test.result.error)
|
|
562
567
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
563
568
|
if (isNode) {
|
|
564
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
569
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.0ab05798.mjs').then(function (n) { return n.q; });
|
|
565
570
|
getSnapshotClient().clearTest();
|
|
566
571
|
}
|
|
567
572
|
test.result.duration = now() - start;
|
|
@@ -601,7 +606,7 @@ async function runSuite(suite) {
|
|
|
601
606
|
try {
|
|
602
607
|
const beforeAllCleanups = await callSuiteHook(suite, suite, "beforeAll", [suite]);
|
|
603
608
|
if (isRunningInBenchmark()) {
|
|
604
|
-
await
|
|
609
|
+
await runBenchmarkSuite(suite);
|
|
605
610
|
} else {
|
|
606
611
|
for (let tasksGroup of partitionSuiteChildren(suite)) {
|
|
607
612
|
if (tasksGroup[0].concurrent === true) {
|
|
@@ -651,20 +656,22 @@ function createBenchmarkResult(name) {
|
|
|
651
656
|
samples: []
|
|
652
657
|
};
|
|
653
658
|
}
|
|
654
|
-
async function
|
|
659
|
+
async function runBenchmarkSuite(suite) {
|
|
660
|
+
const { Task, Bench } = await importTinybench();
|
|
655
661
|
const start = performance.now();
|
|
656
662
|
const benchmarkGroup = [];
|
|
657
663
|
const benchmarkSuiteGroup = [];
|
|
658
664
|
for (const task of suite.tasks) {
|
|
665
|
+
if (task.mode !== "run")
|
|
666
|
+
continue;
|
|
659
667
|
if (task.type === "benchmark")
|
|
660
668
|
benchmarkGroup.push(task);
|
|
661
669
|
else if (task.type === "suite")
|
|
662
670
|
benchmarkSuiteGroup.push(task);
|
|
663
671
|
}
|
|
664
672
|
if (benchmarkSuiteGroup.length)
|
|
665
|
-
await Promise.all(benchmarkSuiteGroup.map((subSuite) =>
|
|
673
|
+
await Promise.all(benchmarkSuiteGroup.map((subSuite) => runBenchmarkSuite(subSuite)));
|
|
666
674
|
if (benchmarkGroup.length) {
|
|
667
|
-
const benchmarkInstance = await getBenchmarkFactory(suite);
|
|
668
675
|
const defer = createDefer();
|
|
669
676
|
const benchmarkMap = {};
|
|
670
677
|
suite.result = {
|
|
@@ -674,6 +681,7 @@ async function runBenchmarkSuit(suite) {
|
|
|
674
681
|
};
|
|
675
682
|
updateTask(suite);
|
|
676
683
|
benchmarkGroup.forEach((benchmark, idx) => {
|
|
684
|
+
const benchmarkInstance = new Bench(benchmark.options);
|
|
677
685
|
const benchmarkFn = getFn(benchmark);
|
|
678
686
|
benchmark.result = {
|
|
679
687
|
state: "run",
|
|
@@ -682,23 +690,34 @@ async function runBenchmarkSuit(suite) {
|
|
|
682
690
|
};
|
|
683
691
|
const id = idx.toString();
|
|
684
692
|
benchmarkMap[id] = benchmark;
|
|
685
|
-
benchmarkInstance
|
|
693
|
+
const task = new Task(benchmarkInstance, id, benchmarkFn);
|
|
694
|
+
benchmark.task = task;
|
|
686
695
|
updateTask(benchmark);
|
|
687
696
|
});
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
+
benchmarkGroup.forEach((benchmark) => {
|
|
698
|
+
benchmark.task.addEventListener("complete", (e) => {
|
|
699
|
+
const task = e.task;
|
|
700
|
+
const _benchmark = benchmarkMap[task.name || ""];
|
|
701
|
+
if (_benchmark) {
|
|
702
|
+
const taskRes = task.result;
|
|
703
|
+
const result = _benchmark.result.benchmark;
|
|
704
|
+
Object.assign(result, taskRes);
|
|
705
|
+
updateTask(_benchmark);
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
benchmark.task.addEventListener("error", (e) => {
|
|
709
|
+
defer.reject(e);
|
|
710
|
+
});
|
|
697
711
|
});
|
|
698
|
-
|
|
712
|
+
Promise.all(benchmarkGroup.map(async (benchmark) => {
|
|
713
|
+
await benchmark.task.warmup();
|
|
714
|
+
return await new Promise((resolve) => safeSetTimeout(async () => {
|
|
715
|
+
resolve(await benchmark.task.run());
|
|
716
|
+
}));
|
|
717
|
+
})).then((tasks) => {
|
|
699
718
|
suite.result.duration = performance.now() - start;
|
|
700
719
|
suite.result.state = "pass";
|
|
701
|
-
|
|
720
|
+
tasks.sort((a, b) => a.result.mean - b.result.mean).forEach((cycle, idx) => {
|
|
702
721
|
const benchmark = benchmarkMap[cycle.name || ""];
|
|
703
722
|
benchmark.result.state = "pass";
|
|
704
723
|
if (benchmark) {
|
|
@@ -710,10 +729,6 @@ async function runBenchmarkSuit(suite) {
|
|
|
710
729
|
updateTask(suite);
|
|
711
730
|
defer.resolve(null);
|
|
712
731
|
});
|
|
713
|
-
benchmarkInstance.addEventListener("error", (e) => {
|
|
714
|
-
defer.reject(e);
|
|
715
|
-
});
|
|
716
|
-
benchmarkInstance.run();
|
|
717
732
|
await defer;
|
|
718
733
|
}
|
|
719
734
|
}
|
|
@@ -754,7 +769,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
754
769
|
async function startTestsNode(paths, config) {
|
|
755
770
|
const files = await collectTests(paths, config);
|
|
756
771
|
rpc().onCollected(files);
|
|
757
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
772
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.0ab05798.mjs').then(function (n) { return n.q; });
|
|
758
773
|
getSnapshotClient().clear();
|
|
759
774
|
await runFiles(files, config);
|
|
760
775
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.
|
|
2
|
-
import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.
|
|
3
|
-
import { p as parseStacktrace } from './chunk-utils-source-map.
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it, b as bench, c as createExpect, e as globalExpect } from './chunk-runtime-chain.0ab05798.mjs';
|
|
2
|
+
import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-mock-date.2917be60.mjs';
|
|
3
|
+
import { p as parseStacktrace } from './chunk-utils-source-map.2be5aa48.mjs';
|
|
4
4
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
|
|
5
5
|
import util from 'util';
|
|
6
6
|
import { spyOn, fn, isMockFunction, spies } from './spy.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-client.da0a17ff.mjs';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { g as getWorkerState, G as mergeSlashes, s as slash, l as getType, H as getAllMockableProperties } from './chunk-mock-date.
|
|
3
|
+
import { g as getWorkerState, G as mergeSlashes, s as slash, l as getType, H as getAllMockableProperties } from './chunk-mock-date.2917be60.mjs';
|
|
4
4
|
import { existsSync, readdirSync } from 'fs';
|
|
5
|
-
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.
|
|
6
|
-
import { d as dirname, j as join, b as basename, a as resolve, c as distDir } from './chunk-constants.
|
|
5
|
+
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.473cd0b2.mjs';
|
|
6
|
+
import { d as dirname, j as join, b as basename, h as extname, a as resolve, c as distDir } from './chunk-constants.71e8a211.mjs';
|
|
7
7
|
|
|
8
8
|
class RefTracker {
|
|
9
9
|
constructor() {
|
|
@@ -76,10 +76,20 @@ const _VitestMocker = class {
|
|
|
76
76
|
const cached = (_a = this.moduleCache.get(dep)) == null ? void 0 : _a.exports;
|
|
77
77
|
if (cached)
|
|
78
78
|
return cached;
|
|
79
|
-
|
|
79
|
+
let exports;
|
|
80
|
+
try {
|
|
81
|
+
exports = await mock();
|
|
82
|
+
} catch (err) {
|
|
83
|
+
const vitestError = new Error(
|
|
84
|
+
"[vitest] There was an error, when mocking a module. If you are using vi.mock, make sure you are not using top level variables inside, since this call is hoisted. Read more: https://vitest.dev/api/#vi-mock"
|
|
85
|
+
);
|
|
86
|
+
vitestError.cause = err;
|
|
87
|
+
throw vitestError;
|
|
88
|
+
}
|
|
80
89
|
if (exports === null || typeof exports !== "object")
|
|
81
90
|
throw new Error('[vitest] vi.mock(path: string, factory?: () => unknown) is not returning an object. Did you mean to return an object with a "default" key?');
|
|
82
91
|
this.moduleCache.set(dep, { exports });
|
|
92
|
+
const filepath = dep.slice("mock:".length);
|
|
83
93
|
const exportHandler = {
|
|
84
94
|
get(target, prop) {
|
|
85
95
|
const val = target[prop];
|
|
@@ -87,7 +97,7 @@ const _VitestMocker = class {
|
|
|
87
97
|
if (target instanceof Promise)
|
|
88
98
|
return target.then.bind(target);
|
|
89
99
|
} else if (!(prop in target)) {
|
|
90
|
-
throw new Error(`[vitest] No "${prop}" export is defined on the "${
|
|
100
|
+
throw new Error(`[vitest] No "${prop}" export is defined on the "${filepath}"`);
|
|
91
101
|
}
|
|
92
102
|
return val;
|
|
93
103
|
}
|
|
@@ -116,10 +126,10 @@ const _VitestMocker = class {
|
|
|
116
126
|
if (!existsSync(mockFolder))
|
|
117
127
|
return null;
|
|
118
128
|
const files = readdirSync(mockFolder);
|
|
119
|
-
const
|
|
129
|
+
const baseOriginal = basename(path);
|
|
120
130
|
for (const file of files) {
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
131
|
+
const baseFile = basename(file, extname(file));
|
|
132
|
+
if (baseFile === baseOriginal)
|
|
123
133
|
return resolve(mockFolder, file);
|
|
124
134
|
}
|
|
125
135
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as slash, j as notNullish } from './chunk-mock-date.
|
|
2
|
-
import { p as picocolors } from './chunk-constants.
|
|
1
|
+
import { s as slash, j as notNullish } from './chunk-mock-date.2917be60.mjs';
|
|
2
|
+
import { p as picocolors } from './chunk-constants.71e8a211.mjs';
|
|
3
3
|
|
|
4
4
|
var build = {};
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import { pathToFileURL, fileURLToPath } from 'url';
|
|
3
3
|
import vm from 'vm';
|
|
4
|
-
import { a as resolve, d as dirname, i as isAbsolute, h as extname } from './chunk-constants.
|
|
5
|
-
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.
|
|
4
|
+
import { a as resolve, d as dirname, i as isAbsolute, h as extname } from './chunk-constants.71e8a211.mjs';
|
|
5
|
+
import { s as slash, n as normalizeRequestId, b as toFilePath, i as isNodeBuiltin, c as isPrimitive, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.473cd0b2.mjs';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
|
|
8
8
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, promises } from 'fs';
|
|
2
|
-
import { a as resolve, p as picocolors, j as join } from './chunk-constants.
|
|
2
|
+
import { a as resolve, p as picocolors, j as join } from './chunk-constants.71e8a211.mjs';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'url';
|
|
5
5
|
import 'path';
|