vitest 1.0.0-beta.3 → 1.0.0-beta.5
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 +3 -498
- package/dist/browser.d.ts +1 -2
- package/dist/browser.js +4 -4
- package/dist/child.js +15 -18
- package/dist/{chunk-api-setup.37a43981.js → chunks/api-setup.jHV5vgr2.js} +101 -39
- package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
- package/dist/chunks/integrations-globals.-pds_Gug.js +29 -0
- package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
- package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.iCAG0Yz3.js} +1 -1
- package/dist/cli-wrapper.js +2 -18
- package/dist/cli.js +21 -23
- package/dist/config.cjs +2 -1
- package/dist/config.d.ts +4 -7
- package/dist/config.js +2 -1
- package/dist/coverage.d.ts +25 -16
- package/dist/coverage.js +118 -49
- package/dist/entry-vm.js +13 -13
- package/dist/entry.js +14 -14
- package/dist/environments.d.ts +1 -2
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -3
- package/dist/execute.js +3 -4
- package/dist/index.d.ts +396 -95
- package/dist/index.js +10 -10
- package/dist/node.d.ts +10 -6
- package/dist/node.js +17 -22
- package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
- package/dist/{reporters-1678fe04.d.ts → reporters-ANEBTnOh.d.ts} +336 -340
- package/dist/reporters.d.ts +1 -2
- package/dist/reporters.js +7 -8
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +8 -9
- package/dist/{suite-0579b50d.d.ts → suite-C1OmA61l.d.ts} +1 -1
- package/dist/suite.d.ts +2 -3
- package/dist/suite.js +3 -3
- package/dist/{vendor-benchmark.44931cfa.js → vendor/benchmark.WVm6DARl.js} +1 -1
- package/dist/{vendor-execute.e6e4e89b.js → vendor/execute.aMjV5C9u.js} +4 -7
- package/dist/vendor/global.L7JRz1qU.js +14 -0
- package/dist/{vendor-index.68ecee35.js → vendor/index.Npc-eff0.js} +11 -4
- package/dist/{vendor-index.29282562.js → vendor/index.XU72Rmy8.js} +1 -1
- package/dist/{vendor-index.3d079eea.js → vendor/index.h0j9y5vy.js} +5 -5
- package/dist/vendor/index.xL8XjTLv.js +3962 -0
- package/dist/vendor/loader.CU0NY2Is.js +39 -0
- package/dist/{vendor-node.327f8f1f.js → vendor/node.c-kzGvOB.js} +2192 -5614
- package/dist/{vendor-reporters.b9600369.js → vendor/reporters.1xKxm8im.js} +424 -374
- package/dist/{vendor-rpc.cbd8e972.js → vendor/rpc.Bl-ysZIr.js} +1 -1
- package/dist/{vendor-run-once.3e5ef7d7.js → vendor/run-once.X3E7xx3F.js} +1 -1
- package/dist/{vendor-vi.d30b47ae.js → vendor/vi.voNYQWB_.js} +35 -38
- package/dist/vm.js +16 -20
- package/dist/worker.js +16 -20
- package/index.cjs +5 -0
- package/package.json +50 -54
- package/dist/chunk-install-pkg.6349b322.js +0 -1740
- package/dist/chunk-integrations-globals.9df12d91.js +0 -29
- package/dist/vendor-global.97e4527c.js +0 -9
- package/dist/vendor-index.8efe7746.js +0 -2236
- package/dist/vendor-loader.9c966f23.js +0 -2089
- /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
- /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
- /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
- /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
- /package/dist/{vendor-date.6e993429.js → vendor/date.W90-E5kF.js} +0 -0
- /package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.hpEVJZPC.js} +0 -0
- /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
- /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
- /package/dist/{vendor-tasks.f9d75aed.js → vendor/tasks.IknbGB2n.js} +0 -0
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ay as BaseReporter, aq as BasicReporter, aC as BenchmarkBuiltinReporters, aB as BenchmarkReportsMap, aA as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, ax as HangingProcessReporter, av as JUnitReporter, as as JsonReporter, q as Reporter, az as ReportersMap, aw as TapFlatReporter, au as TapReporter, at as VerboseReporter } from './reporters-ANEBTnOh.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@vitest/runner';
|
|
4
4
|
import 'vite-node';
|
|
@@ -11,6 +11,5 @@ import 'vite-node/client';
|
|
|
11
11
|
import '@vitest/snapshot/manager';
|
|
12
12
|
import 'vite-node/server';
|
|
13
13
|
import 'node:worker_threads';
|
|
14
|
-
import 'rollup';
|
|
15
14
|
import 'node:fs';
|
|
16
15
|
import 'chai';
|
package/dist/reporters.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
export { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor
|
|
1
|
+
export { f as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, g as DotReporter, H as HangingProcessReporter, h as JUnitReporter, J as JsonReporter, R as ReportersMap, i as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor/reporters.1xKxm8im.js';
|
|
2
2
|
import 'node:perf_hooks';
|
|
3
3
|
import 'picocolors';
|
|
4
|
-
import './vendor
|
|
4
|
+
import './vendor/index.XU72Rmy8.js';
|
|
5
5
|
import 'pathe';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
|
-
import './vendor
|
|
10
|
-
import './
|
|
9
|
+
import './vendor/global.L7JRz1qU.js';
|
|
10
|
+
import './chunks/runtime-console.iCAG0Yz3.js';
|
|
11
11
|
import 'node:stream';
|
|
12
12
|
import 'node:console';
|
|
13
13
|
import 'node:path';
|
|
14
|
-
import './vendor
|
|
15
|
-
import './vendor
|
|
16
|
-
import './vendor
|
|
17
|
-
import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
14
|
+
import './vendor/date.W90-E5kF.js';
|
|
15
|
+
import './vendor/base._79unx2z.js';
|
|
16
|
+
import './vendor/tasks.IknbGB2n.js';
|
|
18
17
|
import 'node:fs';
|
|
19
18
|
import '@vitest/utils/source-map';
|
|
20
19
|
import 'node:os';
|
package/dist/runners.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, Custom, TaskContext, ExtendedContext } from '@vitest/runner';
|
|
2
|
-
import { R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { R as ResolvedConfig } from './reporters-ANEBTnOh.js';
|
|
3
3
|
import * as tinybench from 'tinybench';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import 'vite-node';
|
|
@@ -11,7 +11,6 @@ import 'vite-node/client';
|
|
|
11
11
|
import '@vitest/snapshot/manager';
|
|
12
12
|
import 'vite-node/server';
|
|
13
13
|
import 'node:worker_threads';
|
|
14
|
-
import 'rollup';
|
|
15
14
|
import 'node:fs';
|
|
16
15
|
import 'chai';
|
|
17
16
|
|
package/dist/runners.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor
|
|
3
|
-
import './vendor
|
|
4
|
-
import { a as rpc } from './vendor
|
|
5
|
-
import { g as getFullName } from './vendor
|
|
6
|
-
import { g as getWorkerState } from './vendor
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor/vi.voNYQWB_.js';
|
|
3
|
+
import './vendor/index.XU72Rmy8.js';
|
|
4
|
+
import { a as rpc } from './vendor/rpc.Bl-ysZIr.js';
|
|
5
|
+
import { g as getFullName } from './vendor/tasks.IknbGB2n.js';
|
|
6
|
+
import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
|
|
7
7
|
import { getNames } from '@vitest/runner/utils';
|
|
8
|
-
import { performance } from 'node:perf_hooks';
|
|
9
8
|
import { updateTask } from '@vitest/runner';
|
|
10
9
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
|
11
|
-
import { a as getBenchOptions, g as getBenchFn } from './vendor
|
|
10
|
+
import { a as getBenchOptions, g as getBenchFn } from './vendor/benchmark.WVm6DARl.js';
|
|
12
11
|
import 'chai';
|
|
13
|
-
import './vendor
|
|
12
|
+
import './vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
14
13
|
import '@vitest/snapshot';
|
|
15
14
|
import '@vitest/utils/error';
|
|
16
15
|
import '@vitest/utils/source-map';
|
|
17
|
-
import './vendor
|
|
16
|
+
import './vendor/date.W90-E5kF.js';
|
|
18
17
|
import '@vitest/spy';
|
|
19
18
|
import 'pathe';
|
|
20
19
|
import 'std-env';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { ak as BenchFunction, al as BenchmarkAPI } from './reporters-ANEBTnOh.js';
|
|
4
4
|
import { Options } from 'tinybench';
|
|
5
5
|
|
|
6
6
|
declare function getBenchOptions(key: Custom): Options;
|
package/dist/suite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './suite-
|
|
4
|
-
import './reporters-
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './suite-C1OmA61l.js';
|
|
4
|
+
import './reporters-ANEBTnOh.js';
|
|
5
5
|
import 'vite';
|
|
6
6
|
import 'vite-node';
|
|
7
7
|
import '@vitest/snapshot';
|
|
@@ -12,6 +12,5 @@ import 'vite-node/client';
|
|
|
12
12
|
import '@vitest/snapshot/manager';
|
|
13
13
|
import 'vite-node/server';
|
|
14
14
|
import 'node:worker_threads';
|
|
15
|
-
import 'rollup';
|
|
16
15
|
import 'node:fs';
|
|
17
16
|
import 'chai';
|
package/dist/suite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createTaskCollector, getCurrentSuite, getFn, setFn } from '@vitest/runner';
|
|
2
2
|
export { createChainable } from '@vitest/runner/utils';
|
|
3
|
-
export { g as getBenchFn, a as getBenchOptions } from './vendor
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './vendor/benchmark.WVm6DARl.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './vendor
|
|
5
|
+
import './vendor/index.XU72Rmy8.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import 'std-env';
|
|
8
|
-
import './vendor
|
|
8
|
+
import './vendor/global.L7JRz1qU.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable } from '@vitest/runner/utils';
|
|
3
3
|
import { noop } from '@vitest/utils';
|
|
4
|
-
import { i as isRunningInBenchmark } from './
|
|
4
|
+
import { i as isRunningInBenchmark } from './index.XU72Rmy8.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -4,11 +4,10 @@ import { ModuleCacheMap, ViteNodeRunner, DEFAULT_REQUEST_STUBS } from 'vite-node
|
|
|
4
4
|
import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData, isInternalRequest } from 'vite-node/utils';
|
|
5
5
|
import { resolve, isAbsolute, dirname, join, basename, extname, normalize, relative } from 'pathe';
|
|
6
6
|
import { processError } from '@vitest/utils/error';
|
|
7
|
-
import {
|
|
8
|
-
import { g as getWorkerState } from './vendor-global.97e4527c.js';
|
|
7
|
+
import { distDir } from '../paths.js';
|
|
9
8
|
import { existsSync, readdirSync, statSync, readFileSync } from 'node:fs';
|
|
10
9
|
import { getColors, getType } from '@vitest/utils';
|
|
11
|
-
import { b as getAllMockableProperties } from './
|
|
10
|
+
import { b as getAllMockableProperties } from './base._79unx2z.js';
|
|
12
11
|
import { dirname as dirname$1 } from 'node:path';
|
|
13
12
|
import { createRequire, Module } from 'node:module';
|
|
14
13
|
import { CSS_LANGS_RE, KNOWN_ASSET_RE } from 'vite-node/constants';
|
|
@@ -431,8 +430,6 @@ class CommonjsExecutor {
|
|
|
431
430
|
static _resolveLookupPaths = Module._resolveLookupPaths;
|
|
432
431
|
// @ts-expect-error not typed
|
|
433
432
|
static globalPaths = Module.globalPaths;
|
|
434
|
-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
435
|
-
// @ts-ignore not typed in lower versions
|
|
436
433
|
static isBuiltin = Module.isBuiltin;
|
|
437
434
|
static Module = Module$1;
|
|
438
435
|
};
|
|
@@ -989,7 +986,7 @@ async function startViteNode(options) {
|
|
|
989
986
|
return _viteNode;
|
|
990
987
|
}
|
|
991
988
|
async function startVitestExecutor(options) {
|
|
992
|
-
const state = () =>
|
|
989
|
+
const state = () => globalThis.__vitest_worker__ || options.state;
|
|
993
990
|
const rpc = () => state().rpc;
|
|
994
991
|
const processExit = process.exit;
|
|
995
992
|
process.exit = (code = process.exitCode || 0) => {
|
|
@@ -1115,7 +1112,7 @@ class VitestExecutor extends ViteNodeRunner {
|
|
|
1115
1112
|
return this.primitives;
|
|
1116
1113
|
}
|
|
1117
1114
|
get state() {
|
|
1118
|
-
return
|
|
1115
|
+
return globalThis.__vitest_worker__ || this.options.state;
|
|
1119
1116
|
}
|
|
1120
1117
|
shouldResolveId(id, _importee) {
|
|
1121
1118
|
var _a;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function getWorkerState() {
|
|
2
|
+
const workerState = globalThis.__vitest_worker__;
|
|
3
|
+
if (!workerState) {
|
|
4
|
+
const errorMsg = 'Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n';
|
|
5
|
+
throw new Error(errorMsg);
|
|
6
|
+
}
|
|
7
|
+
return workerState;
|
|
8
|
+
}
|
|
9
|
+
function getCurrentEnvironment() {
|
|
10
|
+
const state = getWorkerState();
|
|
11
|
+
return state == null ? void 0 : state.environment.name;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getCurrentEnvironment as a, getWorkerState as g };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
|
|
2
|
-
import { b as bench } from './
|
|
3
|
-
import { i as isFirstRun, r as runOnce } from './
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './
|
|
2
|
+
import { b as bench } from './benchmark.WVm6DARl.js';
|
|
3
|
+
import { i as isFirstRun, r as runOnce } from './run-once.X3E7xx3F.js';
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.voNYQWB_.js';
|
|
5
|
+
import { g as getWorkerState } from './global.L7JRz1qU.js';
|
|
5
6
|
import * as chai from 'chai';
|
|
6
7
|
import { assert, should } from 'chai';
|
|
7
8
|
|
|
@@ -12,6 +13,11 @@ function isWatchMode() {
|
|
|
12
13
|
return getRunningMode() === "watch";
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
function inject(key) {
|
|
17
|
+
const workerState = getWorkerState();
|
|
18
|
+
return workerState.providedContext[key];
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
var dist = {};
|
|
16
22
|
|
|
17
23
|
(function (exports) {
|
|
@@ -106,6 +112,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
106
112
|
expect: globalExpect,
|
|
107
113
|
expectTypeOf: dist.expectTypeOf,
|
|
108
114
|
getRunningMode: getRunningMode,
|
|
115
|
+
inject: inject,
|
|
109
116
|
isFirstRun: isFirstRun,
|
|
110
117
|
isWatchMode: isWatchMode,
|
|
111
118
|
it: it,
|
|
@@ -118,4 +125,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
118
125
|
vitest: vitest
|
|
119
126
|
});
|
|
120
127
|
|
|
121
|
-
export {
|
|
128
|
+
export { inject as a, isWatchMode as b, assertType as c, dist as d, getRunningMode as g, index as i };
|
|
@@ -2,7 +2,7 @@ import { relative } from 'pathe';
|
|
|
2
2
|
import 'std-env';
|
|
3
3
|
import '@vitest/runner/utils';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import { g as getWorkerState } from './
|
|
5
|
+
import { g as getWorkerState } from './global.L7JRz1qU.js';
|
|
6
6
|
|
|
7
7
|
var _a;
|
|
8
8
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as chai from 'chai';
|
|
2
2
|
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
|
-
import {
|
|
5
|
-
import { g as getWorkerState } from './
|
|
6
|
-
import { a as rpc } from './
|
|
7
|
-
import { t as takeCoverageInsideWorker } from './
|
|
8
|
-
import { loadDiffConfig } from '
|
|
4
|
+
import { distDir } from '../paths.js';
|
|
5
|
+
import { g as getWorkerState } from './global.L7JRz1qU.js';
|
|
6
|
+
import { a as rpc } from './rpc.Bl-ysZIr.js';
|
|
7
|
+
import { t as takeCoverageInsideWorker } from './coverage.v6aD8iAh.js';
|
|
8
|
+
import { loadDiffConfig } from '../browser.js';
|
|
9
9
|
|
|
10
10
|
function setupChaiConfig(config) {
|
|
11
11
|
Object.assign(chai.config, config);
|