vitest 1.0.0-beta.3 → 1.0.0-beta.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/LICENSE.md +17 -0
- package/dist/browser.d.ts +1 -2
- package/dist/browser.js +3 -3
- package/dist/child.js +5 -4
- package/dist/{chunk-api-setup.37a43981.js → chunk-api-setup.6d19ab38.js} +6 -2
- package/dist/{chunk-install-pkg.6349b322.js → chunk-install-pkg.e1d6323e.js} +4 -4
- package/dist/{chunk-integrations-globals.9df12d91.js → chunk-integrations-globals.2b099e04.js} +6 -6
- package/dist/cli.js +8 -5
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +1 -2
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +1 -2
- package/dist/entry-vm.js +8 -8
- package/dist/entry.js +8 -8
- package/dist/environments.d.ts +1 -2
- package/dist/execute.d.ts +2 -3
- package/dist/execute.js +1 -2
- package/dist/index.d.ts +233 -60
- package/dist/index.js +7 -7
- package/dist/node.d.ts +8 -4
- package/dist/node.js +4 -4
- package/dist/{reporters-1678fe04.d.ts → reporters-50c2bd49.d.ts} +39 -6
- package/dist/reporters.d.ts +1 -2
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +5 -6
- package/dist/{suite-0579b50d.d.ts → suite-ad69b7cd.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.b6befc50.js} +1 -1
- package/dist/{vendor-execute.e6e4e89b.js → vendor-execute.157302d6.js} +2 -3
- package/dist/vendor-global.c3664e75.js +14 -0
- package/dist/{vendor-index.29282562.js → vendor-index.2b92937b.js} +1 -1
- package/dist/{vendor-index.3d079eea.js → vendor-index.57925a34.js} +2 -2
- package/dist/{vendor-index.68ecee35.js → vendor-index.72df742e.js} +11 -4
- package/dist/{vendor-node.327f8f1f.js → vendor-node.65461b16.js} +762 -98
- package/dist/{vendor-reporters.b9600369.js → vendor-reporters.d24d80a4.js} +2 -2
- package/dist/{vendor-rpc.cbd8e972.js → vendor-rpc.171f65fb.js} +1 -1
- package/dist/{vendor-run-once.3e5ef7d7.js → vendor-run-once.fb836747.js} +1 -1
- package/dist/{vendor-vi.d30b47ae.js → vendor-vi.3baa7c4a.js} +32 -35
- package/dist/vm.js +6 -5
- package/dist/worker.js +6 -5
- package/package.json +8 -8
- package/dist/vendor-global.97e4527c.js +0 -9
package/dist/reporters.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as BasicReporter, B as BenchmarkReportsMap, D as DefaultReporter, e as DotReporter, H as HangingProcessReporter, f as JUnitReporter, J as JsonReporter, R as ReportersMap, g as TapFlatReporter, T as TapReporter, V as VerboseReporter } from './vendor-reporters.d24d80a4.js';
|
|
2
2
|
import 'node:perf_hooks';
|
|
3
3
|
import 'picocolors';
|
|
4
|
-
import './vendor-index.
|
|
4
|
+
import './vendor-index.2b92937b.js';
|
|
5
5
|
import 'pathe';
|
|
6
6
|
import 'std-env';
|
|
7
7
|
import '@vitest/runner/utils';
|
|
8
8
|
import '@vitest/utils';
|
|
9
|
-
import './vendor-global.
|
|
9
|
+
import './vendor-global.c3664e75.js';
|
|
10
10
|
import './chunk-runtime-console.f3263f87.js';
|
|
11
11
|
import 'node:stream';
|
|
12
12
|
import 'node:console';
|
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-50c2bd49.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,14 +1,13 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor-vi.
|
|
3
|
-
import './vendor-index.
|
|
4
|
-
import { a as rpc } from './vendor-rpc.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './vendor-vi.3baa7c4a.js';
|
|
3
|
+
import './vendor-index.2b92937b.js';
|
|
4
|
+
import { a as rpc } from './vendor-rpc.171f65fb.js';
|
|
5
5
|
import { g as getFullName } from './vendor-tasks.f9d75aed.js';
|
|
6
|
-
import { g as getWorkerState } from './vendor-global.
|
|
6
|
+
import { g as getWorkerState } from './vendor-global.c3664e75.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-benchmark.
|
|
10
|
+
import { a as getBenchOptions, g as getBenchFn } from './vendor-benchmark.b6befc50.js';
|
|
12
11
|
import 'chai';
|
|
13
12
|
import './vendor-_commonjsHelpers.7d1333e8.js';
|
|
14
13
|
import '@vitest/snapshot';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Custom } from '@vitest/runner';
|
|
2
2
|
import '@vitest/runner/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { aj as BenchFunction, ak as BenchmarkAPI } from './reporters-50c2bd49.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-ad69b7cd.js';
|
|
4
|
+
import './reporters-50c2bd49.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-benchmark.
|
|
3
|
+
export { g as getBenchFn, a as getBenchOptions } from './vendor-benchmark.b6befc50.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
|
-
import './vendor-index.
|
|
5
|
+
import './vendor-index.2b92937b.js';
|
|
6
6
|
import 'pathe';
|
|
7
7
|
import 'std-env';
|
|
8
|
-
import './vendor-global.
|
|
8
|
+
import './vendor-global.c3664e75.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 './vendor-index.
|
|
4
|
+
import { i as isRunningInBenchmark } from './vendor-index.2b92937b.js';
|
|
5
5
|
|
|
6
6
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -5,7 +5,6 @@ import { isNodeBuiltin, isPrimitive, toArray, getCachedData, setCacheData, isInt
|
|
|
5
5
|
import { resolve, isAbsolute, dirname, join, basename, extname, normalize, relative } from 'pathe';
|
|
6
6
|
import { processError } from '@vitest/utils/error';
|
|
7
7
|
import { d as distDir } from './vendor-paths.84fc7a99.js';
|
|
8
|
-
import { g as getWorkerState } from './vendor-global.97e4527c.js';
|
|
9
8
|
import { existsSync, readdirSync, statSync, readFileSync } from 'node:fs';
|
|
10
9
|
import { getColors, getType } from '@vitest/utils';
|
|
11
10
|
import { b as getAllMockableProperties } from './vendor-base.9c08bbd0.js';
|
|
@@ -989,7 +988,7 @@ async function startViteNode(options) {
|
|
|
989
988
|
return _viteNode;
|
|
990
989
|
}
|
|
991
990
|
async function startVitestExecutor(options) {
|
|
992
|
-
const state = () =>
|
|
991
|
+
const state = () => globalThis.__vitest_worker__ || options.state;
|
|
993
992
|
const rpc = () => state().rpc;
|
|
994
993
|
const processExit = process.exit;
|
|
995
994
|
process.exit = (code = process.exitCode || 0) => {
|
|
@@ -1115,7 +1114,7 @@ class VitestExecutor extends ViteNodeRunner {
|
|
|
1115
1114
|
return this.primitives;
|
|
1116
1115
|
}
|
|
1117
1116
|
get state() {
|
|
1118
|
-
return
|
|
1117
|
+
return globalThis.__vitest_worker__ || this.options.state;
|
|
1119
1118
|
}
|
|
1120
1119
|
shouldResolveId(id, _importee) {
|
|
1121
1120
|
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 };
|
|
@@ -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 './vendor-global.
|
|
5
|
+
import { g as getWorkerState } from './vendor-global.c3664e75.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;
|
|
@@ -2,8 +2,8 @@ import * as chai from 'chai';
|
|
|
2
2
|
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
4
|
import { d as distDir } from './vendor-paths.84fc7a99.js';
|
|
5
|
-
import { g as getWorkerState } from './vendor-global.
|
|
6
|
-
import { a as rpc } from './vendor-rpc.
|
|
5
|
+
import { g as getWorkerState } from './vendor-global.c3664e75.js';
|
|
6
|
+
import { a as rpc } from './vendor-rpc.171f65fb.js';
|
|
7
7
|
import { t as takeCoverageInsideWorker } from './vendor-coverage.78040316.js';
|
|
8
8
|
import { loadDiffConfig } from './browser.js';
|
|
9
9
|
|
|
@@ -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 './vendor-benchmark.
|
|
3
|
-
import { i as isFirstRun, r as runOnce } from './vendor-run-once.
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vendor-vi.
|
|
2
|
+
import { b as bench } from './vendor-benchmark.b6befc50.js';
|
|
3
|
+
import { i as isFirstRun, r as runOnce } from './vendor-run-once.fb836747.js';
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vendor-vi.3baa7c4a.js';
|
|
5
|
+
import { g as getWorkerState } from './vendor-global.c3664e75.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 };
|