vitest 0.25.0 → 0.25.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/dist/browser.d.ts +3 -3
- package/dist/browser.js +11 -11
- package/dist/{chunk-api-setup.a13c5f9d.js → chunk-api-setup.c5a9009c.js} +3 -3
- package/dist/{chunk-env-node.700b7e95.js → chunk-env-node.67948209.js} +8 -11
- package/dist/{chunk-install-pkg.55bfe508.js → chunk-install-pkg.579a5a27.js} +2 -2
- package/dist/chunk-integrations-globals.06c8d418.js +25 -0
- package/dist/{chunk-node-git.af5c9d73.js → chunk-node-git.5a1b1656.js} +3 -3
- package/dist/{chunk-runtime-chain.3b531731.js → chunk-runtime-chain.a0b441dc.js} +15 -8
- package/dist/{chunk-runtime-error.3cc15c6f.js → chunk-runtime-error.6287172c.js} +2 -2
- package/dist/{chunk-runtime-mocker.a5d87666.js → chunk-runtime-mocker.a5151f99.js} +4 -4
- package/dist/{chunk-runtime-rpc.4a2d45ab.js → chunk-runtime-rpc.1e7530d3.js} +2 -2
- package/dist/{chunk-runtime-setup.f644ac4c.js → chunk-runtime-setup.419ccdd8.js} +33 -20
- package/dist/{chunk-runtime-test-state.31ce8643.js → chunk-runtime-test-state.3cbc4575.js} +17 -4
- package/dist/{chunk-typecheck-constants.410fa7b2.js → chunk-typecheck-constants.4891f22f.js} +2 -2
- package/dist/{chunk-utils-env.7fe285cc.js → chunk-utils-env.03f840f2.js} +0 -0
- package/dist/{chunk-utils-source-map.1a66263d.js → chunk-utils-source-map.c6dfbbc1.js} +1 -1
- package/dist/{chunk-utils-timers.d1fcc6bb.js → chunk-utils-timers.06f993db.js} +1 -1
- package/dist/{chunk-vite-node-client.13ea0a59.js → chunk-vite-node-client.85cc7113.js} +3 -3
- package/dist/{chunk-vite-node-externalize.01d0d22c.js → chunk-vite-node-externalize.72a4d20b.js} +26 -26
- package/dist/{chunk-vite-node-utils.b89230f3.js → chunk-vite-node-utils.8f0b4a12.js} +1 -1
- package/dist/cli-wrapper.js +3 -3
- package/dist/cli.js +11 -11
- package/dist/config.d.ts +1 -1
- package/dist/entry.js +14 -13
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/{index-b68b3c09.d.ts → index-2f5b6168.d.ts} +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.js +8 -8
- package/dist/loader.js +3 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +12 -12
- package/dist/suite.js +6 -6
- package/dist/{types-b3ff5eea.d.ts → types-f302dae9.d.ts} +20 -26
- package/dist/{vendor-index.16d769d7.js → vendor-index.737c3cff.js} +1 -1
- package/dist/{vendor-index.808a85a6.js → vendor-index.9c919048.js} +0 -0
- package/dist/{vendor-index.22806ffb.js → vendor-index.e1d4cf84.js} +0 -0
- package/dist/worker.js +8 -8
- package/package.json +4 -4
- package/dist/chunk-integrations-globals.391b3839.js +0 -25
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-2f5b6168.js';
|
|
2
|
+
import { b as ResolvedConfig } from './types-f302dae9.js';
|
|
3
|
+
export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-f302dae9.js';
|
|
4
4
|
import * as chai from 'chai';
|
|
5
5
|
export { chai };
|
|
6
6
|
export { assert, should } from 'chai';
|
package/dist/browser.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
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
|
-
import { e as dist } from './chunk-runtime-test-state.
|
|
3
|
-
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-runtime-test-state.
|
|
4
|
-
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.
|
|
1
|
+
export { c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.a0b441dc.js';
|
|
2
|
+
import { e as dist } from './chunk-runtime-test-state.3cbc4575.js';
|
|
3
|
+
export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, o as onTestFailed } from './chunk-runtime-test-state.3cbc4575.js';
|
|
4
|
+
export { a as setupGlobalEnv, s as startTests } from './chunk-runtime-setup.419ccdd8.js';
|
|
5
5
|
import * as chai from 'chai';
|
|
6
6
|
export { chai };
|
|
7
7
|
export { assert, should } from 'chai';
|
|
8
8
|
import 'util';
|
|
9
|
-
import './chunk-typecheck-constants.
|
|
9
|
+
import './chunk-typecheck-constants.4891f22f.js';
|
|
10
10
|
import 'path';
|
|
11
|
-
import './chunk-utils-env.
|
|
11
|
+
import './chunk-utils-env.03f840f2.js';
|
|
12
12
|
import 'tty';
|
|
13
13
|
import 'url';
|
|
14
14
|
import 'local-pkg';
|
|
15
15
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
16
|
-
import './chunk-runtime-rpc.
|
|
17
|
-
import './chunk-utils-timers.
|
|
16
|
+
import './chunk-runtime-rpc.1e7530d3.js';
|
|
17
|
+
import './chunk-utils-timers.06f993db.js';
|
|
18
18
|
import 'fs';
|
|
19
|
-
import './chunk-utils-source-map.
|
|
19
|
+
import './chunk-utils-source-map.c6dfbbc1.js';
|
|
20
20
|
import './spy.js';
|
|
21
21
|
import 'tinyspy';
|
|
22
22
|
import 'perf_hooks';
|
|
23
23
|
import './chunk-integrations-coverage.befed097.js';
|
|
24
|
-
import './chunk-runtime-error.
|
|
24
|
+
import './chunk-runtime-error.6287172c.js';
|
|
25
25
|
import 'source-map';
|
|
26
|
-
import './chunk-env-node.
|
|
26
|
+
import './chunk-env-node.67948209.js';
|
|
27
27
|
import 'console';
|
|
28
28
|
|
|
29
29
|
|
|
@@ -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.85cc7113.js';
|
|
3
3
|
import require$$0$1 from 'stream';
|
|
4
4
|
import require$$0 from 'zlib';
|
|
5
5
|
import require$$3 from 'net';
|
|
@@ -9,10 +9,10 @@ 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-utils-env.
|
|
12
|
+
import { A as API_PATH } from './chunk-utils-env.03f840f2.js';
|
|
13
13
|
import 'module';
|
|
14
14
|
import 'vm';
|
|
15
|
-
import './chunk-vite-node-utils.
|
|
15
|
+
import './chunk-vite-node-utils.8f0b4a12.js';
|
|
16
16
|
import 'acorn';
|
|
17
17
|
import 'path';
|
|
18
18
|
import 'assert';
|
|
@@ -33,6 +33,7 @@ const LIVING_KEYS = [
|
|
|
33
33
|
"Comment",
|
|
34
34
|
"DocumentType",
|
|
35
35
|
"NodeList",
|
|
36
|
+
"RadioNodeList",
|
|
36
37
|
"HTMLCollection",
|
|
37
38
|
"HTMLOptionsCollection",
|
|
38
39
|
"DOMStringMap",
|
|
@@ -109,6 +110,7 @@ const LIVING_KEYS = [
|
|
|
109
110
|
"HTMLVideoElement",
|
|
110
111
|
"HTMLAudioElement",
|
|
111
112
|
"HTMLTrackElement",
|
|
113
|
+
"HTMLFormControlsCollection",
|
|
112
114
|
"SVGElement",
|
|
113
115
|
"SVGGraphicsElement",
|
|
114
116
|
"SVGSVGElement",
|
|
@@ -139,6 +141,7 @@ const LIVING_KEYS = [
|
|
|
139
141
|
"Location",
|
|
140
142
|
"History",
|
|
141
143
|
"Screen",
|
|
144
|
+
"Crypto",
|
|
142
145
|
"Performance",
|
|
143
146
|
"Navigator",
|
|
144
147
|
"PluginArray",
|
|
@@ -172,6 +175,7 @@ const LIVING_KEYS = [
|
|
|
172
175
|
"Headers",
|
|
173
176
|
"AbortController",
|
|
174
177
|
"AbortSignal",
|
|
178
|
+
"ArrayBuffer",
|
|
175
179
|
"Image",
|
|
176
180
|
"Audio",
|
|
177
181
|
"Option"
|
|
@@ -234,13 +238,6 @@ const OTHER_KEYS = [
|
|
|
234
238
|
];
|
|
235
239
|
const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
|
|
236
240
|
|
|
237
|
-
const allowRewrite = [
|
|
238
|
-
"Event",
|
|
239
|
-
"EventTarget",
|
|
240
|
-
"MessageEvent",
|
|
241
|
-
"ArrayBuffer",
|
|
242
|
-
"Blob"
|
|
243
|
-
];
|
|
244
241
|
const skipKeys = [
|
|
245
242
|
"window",
|
|
246
243
|
"self",
|
|
@@ -252,7 +249,7 @@ function getWindowKeys(global, win) {
|
|
|
252
249
|
if (skipKeys.includes(k))
|
|
253
250
|
return false;
|
|
254
251
|
if (k in global)
|
|
255
|
-
return
|
|
252
|
+
return KEYS.includes(k);
|
|
256
253
|
return true;
|
|
257
254
|
}));
|
|
258
255
|
return keys;
|
|
@@ -263,12 +260,12 @@ function isClassLikeName(name) {
|
|
|
263
260
|
function populateGlobal(global, win, options = {}) {
|
|
264
261
|
const { bindFunctions = false } = options;
|
|
265
262
|
const keys = getWindowKeys(global, win);
|
|
266
|
-
const originals = new Map(
|
|
267
|
-
allowRewrite.filter((key) => key in global).map((key) => [key, global[key]])
|
|
268
|
-
);
|
|
263
|
+
const originals = /* @__PURE__ */ new Map();
|
|
269
264
|
const overrideObject = /* @__PURE__ */ new Map();
|
|
270
265
|
for (const key of keys) {
|
|
271
266
|
const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
|
|
267
|
+
if (KEYS.includes(key) && key in global)
|
|
268
|
+
originals.set(key, global[key]);
|
|
272
269
|
Object.defineProperty(global, key, {
|
|
273
270
|
get() {
|
|
274
271
|
if (overrideObject.has(key))
|
|
@@ -2,8 +2,8 @@ import fs$2 from 'fs';
|
|
|
2
2
|
import path$2 from 'path';
|
|
3
3
|
import util from 'util';
|
|
4
4
|
import childProcess$1 from 'child_process';
|
|
5
|
-
import { p as pathKey, s as signalExit, 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, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.e1d4cf84.js';
|
|
6
|
+
import { o as onetime$1 } from './vendor-index.9c919048.js';
|
|
7
7
|
import require$$0 from 'os';
|
|
8
8
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
9
9
|
import 'assert';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { m as globalApis } from './chunk-utils-env.03f840f2.js';
|
|
2
|
+
import { i as index } from './chunk-runtime-test-state.3cbc4575.js';
|
|
3
|
+
import 'tty';
|
|
4
|
+
import 'url';
|
|
5
|
+
import 'path';
|
|
6
|
+
import './chunk-runtime-chain.a0b441dc.js';
|
|
7
|
+
import 'util';
|
|
8
|
+
import './chunk-typecheck-constants.4891f22f.js';
|
|
9
|
+
import 'local-pkg';
|
|
10
|
+
import 'chai';
|
|
11
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
12
|
+
import './chunk-runtime-rpc.1e7530d3.js';
|
|
13
|
+
import './chunk-utils-timers.06f993db.js';
|
|
14
|
+
import 'fs';
|
|
15
|
+
import './chunk-utils-source-map.c6dfbbc1.js';
|
|
16
|
+
import './spy.js';
|
|
17
|
+
import 'tinyspy';
|
|
18
|
+
|
|
19
|
+
function registerApiGlobally() {
|
|
20
|
+
globalApis.forEach((api) => {
|
|
21
|
+
globalThis[api] = index[api];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { registerApiGlobally };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { b as resolve } from './chunk-utils-env.
|
|
2
|
-
import { e as execa } from './vendor-index.
|
|
1
|
+
import { b as resolve } from './chunk-utils-env.03f840f2.js';
|
|
2
|
+
import { e as execa } from './vendor-index.737c3cff.js';
|
|
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.e1d4cf84.js';
|
|
10
10
|
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
11
|
import 'fs';
|
|
12
12
|
import 'assert';
|
|
@@ -1,13 +1,13 @@
|
|
|
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, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-typecheck-constants.
|
|
2
|
+
import { i as isObject, b as getCallLastIndex, s as slash, g as getWorkerState, c as getNames, d as assertTypes, e as getFullName, n as noop, f as isRunningInTest, h as isRunningInBenchmark } from './chunk-typecheck-constants.4891f22f.js';
|
|
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.addc3445.js';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.1e7530d3.js';
|
|
7
7
|
import fs, { promises } from 'fs';
|
|
8
|
-
import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.
|
|
9
|
-
import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.
|
|
10
|
-
import { a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.
|
|
8
|
+
import { j as join, d as dirname, p as picocolors } from './chunk-utils-env.03f840f2.js';
|
|
9
|
+
import { p as plugins_1, f as format_1, u as unifiedDiff, a as stringify, m as matcherUtils, s as safeSetTimeout, b as safeClearTimeout } from './chunk-utils-timers.06f993db.js';
|
|
10
|
+
import { a as posToNumber, n as numberToPos, l as lineSplitRE, p as parseStacktrace } from './chunk-utils-source-map.c6dfbbc1.js';
|
|
11
11
|
import { isMockFunction } from './spy.js';
|
|
12
12
|
|
|
13
13
|
function createChainable(keys, fn) {
|
|
@@ -168,7 +168,7 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
168
168
|
return Object.is(a.valueOf(), b.valueOf());
|
|
169
169
|
}
|
|
170
170
|
case "[object Date]":
|
|
171
|
-
return +a === +b;
|
|
171
|
+
return isNaN(a) && isNaN(b) || +a === +b;
|
|
172
172
|
case "[object RegExp]":
|
|
173
173
|
return a.source === b.source && a.flags === b.flags;
|
|
174
174
|
}
|
|
@@ -2197,6 +2197,7 @@ If this is a long-running test, pass a timeout value as the last argument or con
|
|
|
2197
2197
|
|
|
2198
2198
|
const fnMap = /* @__PURE__ */ new WeakMap();
|
|
2199
2199
|
const hooksMap = /* @__PURE__ */ new WeakMap();
|
|
2200
|
+
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
2200
2201
|
function setFn(key, fn) {
|
|
2201
2202
|
fnMap.set(key, fn);
|
|
2202
2203
|
}
|
|
@@ -2209,6 +2210,12 @@ function setHooks(key, hooks) {
|
|
|
2209
2210
|
function getHooks(key) {
|
|
2210
2211
|
return hooksMap.get(key);
|
|
2211
2212
|
}
|
|
2213
|
+
function setBenchOptions(key, val) {
|
|
2214
|
+
benchOptsMap.set(key, val);
|
|
2215
|
+
}
|
|
2216
|
+
function getBenchOptions(key) {
|
|
2217
|
+
return benchOptsMap.get(key);
|
|
2218
|
+
}
|
|
2212
2219
|
|
|
2213
2220
|
const suite = createSuite();
|
|
2214
2221
|
const test = createTest(
|
|
@@ -2286,10 +2293,10 @@ function createSuiteCollector(name, factory = () => {
|
|
|
2286
2293
|
id: "",
|
|
2287
2294
|
name: name2,
|
|
2288
2295
|
mode: mode2,
|
|
2289
|
-
options,
|
|
2290
2296
|
suite: void 0
|
|
2291
2297
|
};
|
|
2292
2298
|
setFn(benchmark2, fn);
|
|
2299
|
+
setBenchOptions(benchmark2, options);
|
|
2293
2300
|
tasks.push(benchmark2);
|
|
2294
2301
|
});
|
|
2295
2302
|
const collector = {
|
|
@@ -2405,4 +2412,4 @@ function formatTitle(template, items, idx) {
|
|
|
2405
2412
|
return formatted;
|
|
2406
2413
|
}
|
|
2407
2414
|
|
|
2408
|
-
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,
|
|
2415
|
+
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, getBenchOptions as m, getFn as n, setState as o, getState as p, createSuiteHooks as q, chai$1 as r, suite as s, test as t, withTimeout as w };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import util$1 from 'util';
|
|
2
2
|
import { util } from 'chai';
|
|
3
|
-
import { a as stringify } from './chunk-utils-timers.
|
|
4
|
-
import { v as deepClone, w as getType } from './chunk-typecheck-constants.
|
|
3
|
+
import { a as stringify } from './chunk-utils-timers.06f993db.js';
|
|
4
|
+
import { v as deepClone, w as getType } from './chunk-typecheck-constants.4891f22f.js';
|
|
5
5
|
|
|
6
6
|
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
7
7
|
const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { V as ViteNodeRunner } from './chunk-vite-node-client.
|
|
1
|
+
import { V as ViteNodeRunner } from './chunk-vite-node-client.85cc7113.js';
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
|
-
import { g as getWorkerState, H as mergeSlashes, s as slash, w as getType, I as getAllMockableProperties } from './chunk-typecheck-constants.
|
|
3
|
+
import { g as getWorkerState, H as mergeSlashes, s as slash, w as getType, I as getAllMockableProperties } from './chunk-typecheck-constants.4891f22f.js';
|
|
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, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.
|
|
5
|
+
import { n as normalizeRequestId, p as pathFromRoot, i as isNodeBuiltin, b as toFilePath } from './chunk-vite-node-utils.8f0b4a12.js';
|
|
6
|
+
import { d as dirname, j as join, c as basename, l as extname, b as resolve, e as distDir } from './chunk-utils-env.03f840f2.js';
|
|
7
7
|
|
|
8
8
|
class RefTracker {
|
|
9
9
|
constructor() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getWorkerState } from './chunk-typecheck-constants.
|
|
2
|
-
import { s as safeSetTimeout } from './chunk-utils-timers.
|
|
1
|
+
import { g as getWorkerState } from './chunk-typecheck-constants.4891f22f.js';
|
|
2
|
+
import { s as safeSetTimeout } from './chunk-utils-timers.06f993db.js';
|
|
3
3
|
|
|
4
4
|
const safeRandom = Math.random;
|
|
5
5
|
function withSafeTimers(fn) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { s as someTasksAreOnly, i as interpretTaskModes, t as takeCoverageInsideWorker, p as pLimit } from './chunk-integrations-coverage.befed097.js';
|
|
3
|
-
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-runtime-test-state.
|
|
4
|
-
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, o as hasTests, q as hasFailed, u as createDefer,
|
|
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.
|
|
7
|
-
import { p as processError } from './chunk-runtime-error.
|
|
3
|
+
import { r as resetRunOnceCounter, i as index, v as vi, s as setCurrentTest } from './chunk-runtime-test-state.3cbc4575.js';
|
|
4
|
+
import { g as getWorkerState, R as RealDate, t as toArray, k as relativePath, h as isRunningInBenchmark, p as partitionSuiteChildren, l as shuffle, o as hasTests, q as hasFailed, u as createDefer, e as getFullName } from './chunk-typecheck-constants.4891f22f.js';
|
|
5
|
+
import { f as clearCollectorContext, h as defaultSuite, j as setHooks, k as getHooks, l as collectorContext, m as getBenchOptions, n as getFn, o as setState, G as GLOBAL_EXPECT, p as getState } from './chunk-runtime-chain.a0b441dc.js';
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.1e7530d3.js';
|
|
7
|
+
import { p as processError } from './chunk-runtime-error.6287172c.js';
|
|
8
8
|
import require$$0 from 'source-map';
|
|
9
9
|
import path from 'path';
|
|
10
|
-
import { e as environments } from './chunk-env-node.
|
|
11
|
-
import { i as isNode, a as isBrowser } from './chunk-utils-env.
|
|
12
|
-
import { b as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.
|
|
10
|
+
import { e as environments } from './chunk-env-node.67948209.js';
|
|
11
|
+
import { i as isNode, a as isBrowser } from './chunk-utils-env.03f840f2.js';
|
|
12
|
+
import { b as safeClearTimeout, s as safeSetTimeout } from './chunk-utils-timers.06f993db.js';
|
|
13
13
|
|
|
14
14
|
var sourceMapSupport = {exports: {}};
|
|
15
15
|
|
|
@@ -202,6 +202,7 @@ var bufferFrom_1 = bufferFrom;
|
|
|
202
202
|
if (!fs) {
|
|
203
203
|
// Use SJAX if we are in the browser
|
|
204
204
|
var xhr = new XMLHttpRequest();
|
|
205
|
+
console.trace('zdes');
|
|
205
206
|
xhr.open('GET', path, /** async */ false);
|
|
206
207
|
xhr.send(null);
|
|
207
208
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
@@ -749,7 +750,7 @@ async function setupGlobalEnv(config) {
|
|
|
749
750
|
await setupConsoleLogSpy();
|
|
750
751
|
}
|
|
751
752
|
if (config.globals)
|
|
752
|
-
(await import('./chunk-integrations-globals.
|
|
753
|
+
(await import('./chunk-integrations-globals.06c8d418.js')).registerApiGlobally();
|
|
753
754
|
}
|
|
754
755
|
function setupDefines(defines) {
|
|
755
756
|
for (const key in defines)
|
|
@@ -989,6 +990,12 @@ function updateSuiteHookState(suite, name, state) {
|
|
|
989
990
|
updateTask(suite);
|
|
990
991
|
}
|
|
991
992
|
}
|
|
993
|
+
function getSuiteHooks(suite, name, sequence) {
|
|
994
|
+
const hooks = getHooks(suite)[name];
|
|
995
|
+
if (sequence === "stack" && (name === "afterAll" || name === "afterEach"))
|
|
996
|
+
return hooks.slice().reverse();
|
|
997
|
+
return hooks;
|
|
998
|
+
}
|
|
992
999
|
async function callSuiteHook(suite, currentTask, name, args) {
|
|
993
1000
|
const callbacks = [];
|
|
994
1001
|
if (name === "beforeEach" && suite.suite) {
|
|
@@ -997,9 +1004,15 @@ async function callSuiteHook(suite, currentTask, name, args) {
|
|
|
997
1004
|
);
|
|
998
1005
|
}
|
|
999
1006
|
updateSuiteHookState(currentTask, name, "run");
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
);
|
|
1007
|
+
const state = getWorkerState();
|
|
1008
|
+
const sequence = state.config.sequence.hooks;
|
|
1009
|
+
const hooks = getSuiteHooks(suite, name, sequence);
|
|
1010
|
+
if (sequence === "parallel") {
|
|
1011
|
+
callbacks.push(...await Promise.all(hooks.map((fn) => fn(...args))));
|
|
1012
|
+
} else {
|
|
1013
|
+
for (const hook of hooks)
|
|
1014
|
+
callbacks.push(await hook(...args));
|
|
1015
|
+
}
|
|
1003
1016
|
updateSuiteHookState(currentTask, name, "pass");
|
|
1004
1017
|
if (name === "afterEach" && suite.suite) {
|
|
1005
1018
|
callbacks.push(
|
|
@@ -1029,16 +1042,15 @@ async function sendTasksUpdate() {
|
|
|
1029
1042
|
}
|
|
1030
1043
|
const callCleanupHooks = async (cleanups) => {
|
|
1031
1044
|
await Promise.all(cleanups.map(async (fn) => {
|
|
1032
|
-
if (
|
|
1045
|
+
if (typeof fn !== "function")
|
|
1033
1046
|
return;
|
|
1034
|
-
assertTypes(fn, "hook teardown", ["function"]);
|
|
1035
1047
|
await fn();
|
|
1036
1048
|
}));
|
|
1037
1049
|
};
|
|
1038
1050
|
async function runTest(test) {
|
|
1039
1051
|
var _a, _b, _c;
|
|
1040
1052
|
if (test.mode !== "run") {
|
|
1041
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
1053
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.a0b441dc.js').then(function (n) { return n.r; });
|
|
1042
1054
|
getSnapshotClient().skipTestSnapshots(test);
|
|
1043
1055
|
return;
|
|
1044
1056
|
}
|
|
@@ -1055,7 +1067,7 @@ async function runTest(test) {
|
|
|
1055
1067
|
clearModuleMocks();
|
|
1056
1068
|
setCurrentTest(test);
|
|
1057
1069
|
if (isNode) {
|
|
1058
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
1070
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.a0b441dc.js').then(function (n) { return n.r; });
|
|
1059
1071
|
await getSnapshotClient().setTest(test);
|
|
1060
1072
|
}
|
|
1061
1073
|
const workerState = getWorkerState();
|
|
@@ -1064,7 +1076,6 @@ async function runTest(test) {
|
|
|
1064
1076
|
for (let retryCount = 0; retryCount < retry; retryCount++) {
|
|
1065
1077
|
let beforeEachCleanups = [];
|
|
1066
1078
|
try {
|
|
1067
|
-
beforeEachCleanups = await callSuiteHook(test.suite, test, "beforeEach", [test.context, test.suite]);
|
|
1068
1079
|
setState({
|
|
1069
1080
|
assertionCalls: 0,
|
|
1070
1081
|
isExpectingAssertions: false,
|
|
@@ -1074,6 +1085,7 @@ async function runTest(test) {
|
|
|
1074
1085
|
testPath: (_b = test.suite.file) == null ? void 0 : _b.filepath,
|
|
1075
1086
|
currentTestName: getFullName(test)
|
|
1076
1087
|
}, globalThis[GLOBAL_EXPECT]);
|
|
1088
|
+
beforeEachCleanups = await callSuiteHook(test.suite, test, "beforeEach", [test.context, test.suite]);
|
|
1077
1089
|
test.result.retryCount = retryCount;
|
|
1078
1090
|
await getFn(test)();
|
|
1079
1091
|
const {
|
|
@@ -1118,7 +1130,7 @@ async function runTest(test) {
|
|
|
1118
1130
|
console.error(test.result.error.message, test.result.error.stackStr);
|
|
1119
1131
|
setCurrentTest(void 0);
|
|
1120
1132
|
if (isNode) {
|
|
1121
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
1133
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.a0b441dc.js').then(function (n) { return n.r; });
|
|
1122
1134
|
getSnapshotClient().clearTest();
|
|
1123
1135
|
}
|
|
1124
1136
|
test.result.duration = now() - start;
|
|
@@ -1233,7 +1245,8 @@ async function runBenchmarkSuite(suite) {
|
|
|
1233
1245
|
};
|
|
1234
1246
|
updateTask(suite);
|
|
1235
1247
|
benchmarkGroup.forEach((benchmark, idx) => {
|
|
1236
|
-
const
|
|
1248
|
+
const options = getBenchOptions(benchmark);
|
|
1249
|
+
const benchmarkInstance = new Bench(options);
|
|
1237
1250
|
const benchmarkFn = getFn(benchmark);
|
|
1238
1251
|
benchmark.result = {
|
|
1239
1252
|
state: "run",
|
|
@@ -1323,7 +1336,7 @@ async function startTestsBrowser(paths, config) {
|
|
|
1323
1336
|
async function startTestsNode(paths, config) {
|
|
1324
1337
|
const files = await collectTests(paths, config);
|
|
1325
1338
|
rpc().onCollected(files);
|
|
1326
|
-
const { getSnapshotClient } = await import('./chunk-runtime-chain.
|
|
1339
|
+
const { getSnapshotClient } = await import('./chunk-runtime-chain.a0b441dc.js').then(function (n) { return n.r; });
|
|
1327
1340
|
getSnapshotClient().clear();
|
|
1328
1341
|
await runFiles(files, config);
|
|
1329
1342
|
const coverage = await takeCoverageInsideWorker(config.coverage);
|
|
@@ -1,10 +1,10 @@
|
|
|
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-typecheck-constants.
|
|
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.a0b441dc.js';
|
|
2
|
+
import { g as getWorkerState, R as RealDate, r as resetDate, m as mockDate, a as resetModules } from './chunk-typecheck-constants.4891f22f.js';
|
|
3
|
+
import { p as parseStacktrace } from './chunk-utils-source-map.c6dfbbc1.js';
|
|
4
4
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
5
5
|
import util from 'util';
|
|
6
6
|
import { spyOn, fn, isMockFunction, spies } from './spy.js';
|
|
7
|
-
import { s as safeSetTimeout } from './chunk-utils-timers.
|
|
7
|
+
import { s as safeSetTimeout } from './chunk-utils-timers.06f993db.js';
|
|
8
8
|
import * as chai from 'chai';
|
|
9
9
|
import { assert, should } from 'chai';
|
|
10
10
|
|
|
@@ -2683,6 +2683,7 @@ class VitestUtils {
|
|
|
2683
2683
|
constructor() {
|
|
2684
2684
|
this.spyOn = spyOn;
|
|
2685
2685
|
this.fn = fn;
|
|
2686
|
+
this._config = null;
|
|
2686
2687
|
this._mocker = typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : null;
|
|
2687
2688
|
this._mockedDate = null;
|
|
2688
2689
|
if (!this._mocker) {
|
|
@@ -2813,6 +2814,18 @@ class VitestUtils {
|
|
|
2813
2814
|
await Promise.allSettled(promises);
|
|
2814
2815
|
await new Promise((resolve) => safeSetTimeout(resolve, 1)).then(() => Promise.resolve());
|
|
2815
2816
|
}
|
|
2817
|
+
setConfig(config) {
|
|
2818
|
+
const state = getWorkerState();
|
|
2819
|
+
if (!this._config)
|
|
2820
|
+
this._config = { ...state.config };
|
|
2821
|
+
Object.assign(state.config, config);
|
|
2822
|
+
}
|
|
2823
|
+
resetConfig() {
|
|
2824
|
+
if (this._config) {
|
|
2825
|
+
const state = getWorkerState();
|
|
2826
|
+
state.config = { ...this._config };
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2816
2829
|
}
|
|
2817
2830
|
const vitest = new VitestUtils();
|
|
2818
2831
|
const vi = vitest;
|
package/dist/{chunk-typecheck-constants.410fa7b2.js → chunk-typecheck-constants.4891f22f.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { relative } from 'path';
|
|
2
|
-
import { i as isNode, a as isBrowser, r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.
|
|
2
|
+
import { i as isNode, a as isBrowser, r as relative$1, p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.03f840f2.js';
|
|
3
3
|
import { isPackageExists } from 'local-pkg';
|
|
4
4
|
|
|
5
5
|
const TYPECHECK_SUITE = Symbol("vitest:typecheck-suite");
|
|
@@ -289,7 +289,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
289
289
|
message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
|
|
290
290
|
});
|
|
291
291
|
if (install) {
|
|
292
|
-
await (await import('./chunk-install-pkg.
|
|
292
|
+
await (await import('./chunk-install-pkg.579a5a27.js')).installPackage(dependency, { dev: true });
|
|
293
293
|
process.stderr.write(picocolors.exports.yellow(`
|
|
294
294
|
Package ${dependency} installed, re-run the command to start.
|
|
295
295
|
`));
|
|
File without changes
|
|
@@ -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 { b as resolve, d as dirname, g as isAbsolute, l as extname } from './chunk-utils-env.
|
|
5
|
-
import { s as slash, n as normalizeRequestId, b as toFilePath,
|
|
4
|
+
import { b as resolve, d as dirname, g as isAbsolute, l as extname } from './chunk-utils-env.03f840f2.js';
|
|
5
|
+
import { s as slash, n as normalizeRequestId, b as toFilePath, c as isPrimitive, i as isNodeBuiltin, d as normalizeModuleId, m as mergeSlashes } from './chunk-vite-node-utils.8f0b4a12.js';
|
|
6
6
|
import createDebug from 'debug';
|
|
7
7
|
|
|
8
8
|
const debugExecute = createDebug("vite-node:client:execute");
|
|
@@ -209,7 +209,7 @@ ${getStack()}`), 2e3);
|
|
|
209
209
|
set(_, p, value) {
|
|
210
210
|
if (!Reflect.has(exports, "default"))
|
|
211
211
|
exports.default = {};
|
|
212
|
-
if (exports.default
|
|
212
|
+
if (isPrimitive(exports.default)) {
|
|
213
213
|
defineExport(exports, p, () => void 0);
|
|
214
214
|
return true;
|
|
215
215
|
}
|