vitest 0.29.8 → 0.30.0
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 +2 -81
- package/dist/browser.d.ts +5 -3
- package/dist/browser.js +5 -6
- package/dist/child.js +12 -16
- package/dist/{chunk-api-setup.3aabe9ac.js → chunk-api-setup.6662587e.js} +53 -48
- package/dist/{chunk-install-pkg.6aa7cf6d.js → chunk-install-pkg.6450b372.js} +32 -32
- package/dist/chunk-integrations-globals.d419838f.js +26 -0
- package/dist/{chunk-node-git.ed5bded8.js → chunk-node-git.4c43bd73.js} +4 -2
- package/dist/cli-wrapper.js +6 -5
- package/dist/cli.js +26 -26
- package/dist/config.cjs +15 -2
- package/dist/config.d.ts +15 -4
- package/dist/config.js +10 -1
- package/dist/coverage.d.ts +5 -2
- package/dist/coverage.js +6 -0
- package/dist/entry.js +34 -34
- package/dist/environments.d.ts +5 -2
- package/dist/environments.js +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +9 -11
- package/dist/loader.js +396 -13
- package/dist/node.d.ts +9 -7
- package/dist/node.js +27 -30
- package/dist/runners.d.ts +5 -2
- package/dist/runners.js +34 -31
- package/dist/{types-94cfe4b4.d.ts → types-f03c83c4.d.ts} +225 -306
- package/dist/{chunk-node-pkg.30d8b37e.js → vendor-cli-api.c04eaa34.js} +3845 -3326
- package/dist/vendor-constants.538d9b49.js +54 -0
- package/dist/{chunk-runtime-mocker.3283818a.js → vendor-execute.8eaab47b.js} +9 -12
- package/dist/{chunk-utils-base.b5ddfcc9.js → vendor-index.4f82d248.js} +80 -10
- package/dist/{chunk-env-node.affdd278.js → vendor-index.75f2b63d.js} +9 -2
- package/dist/{chunk-integrations-utils.23c19408.js → vendor-index.81b9e499.js} +22 -21
- package/dist/{vendor-index.2cbcdd1e.js → vendor-index.c1e09929.js} +458 -373
- package/dist/vendor-index.fad2598b.js +44 -0
- package/dist/{vendor-index.534e612c.js → vendor-index.fc98d30f.js} +2 -2
- package/dist/{chunk-runtime-inspector.b1427a10.js → vendor-inspector.47fc8cbb.js} +5 -2
- package/dist/{chunk-runtime-rpc.d6aa57f8.js → vendor-rpc.4d3d7a54.js} +5 -5
- package/dist/{chunk-integrations-run-once.ea614f17.js → vendor-run-once.69ce7172.js} +3 -3
- package/dist/{chunk-runtime-setup.5d504677.js → vendor-setup.common.cef38f4e.js} +2 -2
- package/dist/vendor-tasks.042d6084.js +14 -0
- package/dist/{chunk-utils-import.e488ace3.js → vendor-vi.a3ff54b1.js} +73 -2957
- package/dist/worker.js +13 -18
- package/package.json +29 -34
- package/dist/chunk-constants.bc18a549.js +0 -36
- package/dist/chunk-integrations-globals.49802775.js +0 -28
- package/dist/chunk-snapshot-env.a347d647.js +0 -11
- package/dist/chunk-utils-env.6b856dbf.js +0 -64
- package/dist/chunk-utils-tasks.8781fd71.js +0 -107
- package/dist/env-afee91f0.d.ts +0 -10
- package/dist/vendor-index.783e7f3e.js +0 -71
- package/dist/vendor-index.bdee400f.js +0 -396
- package/dist/vendor-magic-string.es.b3bc5745.js +0 -1591
- /package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.76cdd49e.js} +0 -0
- /package/dist/{chunk-integrations-coverage.d93ee824.js → vendor-coverage.a585b712.js} +0 -0
- /package/dist/{chunk-utils-global.fd174983.js → vendor-global.6795f91f.js} +0 -0
- /package/dist/{chunk-paths.e36446b4.js → vendor-paths.84fc7a99.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { relative } from 'pathe';
|
|
2
|
+
import 'std-env';
|
|
3
|
+
import '@vitest/runner/utils';
|
|
4
|
+
import '@vitest/utils';
|
|
5
|
+
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
6
|
+
|
|
7
|
+
var _a;
|
|
8
|
+
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
9
|
+
|
|
10
|
+
const isWindows = isNode && process.platform === "win32";
|
|
11
|
+
function getRunMode() {
|
|
12
|
+
return getWorkerState().config.mode;
|
|
13
|
+
}
|
|
14
|
+
function isRunningInBenchmark() {
|
|
15
|
+
return getRunMode() === "benchmark";
|
|
16
|
+
}
|
|
17
|
+
const relativePath = relative;
|
|
18
|
+
function resetModules(modules, resetMocks = false) {
|
|
19
|
+
const skipPaths = [
|
|
20
|
+
// Vitest
|
|
21
|
+
/\/vitest\/dist\//,
|
|
22
|
+
/\/vite-node\/dist\//,
|
|
23
|
+
// yarn's .store folder
|
|
24
|
+
/vitest-virtual-\w+\/dist/,
|
|
25
|
+
// cnpm
|
|
26
|
+
/@vitest\/dist/,
|
|
27
|
+
// don't clear mocks
|
|
28
|
+
...!resetMocks ? [/^mock:/] : []
|
|
29
|
+
];
|
|
30
|
+
modules.forEach((mod, path) => {
|
|
31
|
+
if (skipPaths.some((re) => re.test(path)))
|
|
32
|
+
return;
|
|
33
|
+
modules.invalidateModule(mod);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function removeUndefinedValues(obj) {
|
|
37
|
+
for (const key in Object.keys(obj)) {
|
|
38
|
+
if (obj[key] === void 0)
|
|
39
|
+
delete obj[key];
|
|
40
|
+
}
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { removeUndefinedValues as a, isWindows as b, resetModules as c, isRunningInBenchmark as d, isNode as i, relativePath as r };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.
|
|
1
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
|
|
2
2
|
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -141,7 +141,7 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
|
|
|
141
141
|
|
|
142
142
|
var index = /*#__PURE__*/_mergeNamespaces({
|
|
143
143
|
__proto__: null,
|
|
144
|
-
|
|
144
|
+
default: eventTargetPolyfill
|
|
145
145
|
}, [eventTargetPolyfill]);
|
|
146
146
|
|
|
147
147
|
export { index as i };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
2
|
|
|
3
|
+
const __require = createRequire(import.meta.url);
|
|
4
|
+
let inspector;
|
|
3
5
|
function setupInspect(config) {
|
|
4
6
|
const isEnabled = config.inspect || config.inspectBrk;
|
|
5
7
|
if (isEnabled) {
|
|
8
|
+
inspector = __require("node:inspector");
|
|
6
9
|
const isOpen = inspector.url() !== void 0;
|
|
7
10
|
if (!isOpen) {
|
|
8
11
|
inspector.open();
|
|
@@ -12,7 +15,7 @@ function setupInspect(config) {
|
|
|
12
15
|
}
|
|
13
16
|
const keepOpen = config.watch && !config.isolate && config.singleThread;
|
|
14
17
|
return function cleanup() {
|
|
15
|
-
if (isEnabled && !keepOpen)
|
|
18
|
+
if (isEnabled && !keepOpen && inspector)
|
|
16
19
|
inspector.close();
|
|
17
20
|
};
|
|
18
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSafeTimers } from '@vitest/utils';
|
|
2
|
-
import { g as getWorkerState } from './
|
|
2
|
+
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
3
3
|
|
|
4
4
|
const { get } = Reflect;
|
|
5
5
|
const safeRandom = Math.random;
|
|
@@ -32,13 +32,13 @@ function withSafeTimers(fn) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
const promises = /* @__PURE__ */ new Set();
|
|
35
|
-
|
|
35
|
+
async function rpcDone() {
|
|
36
36
|
if (!promises.size)
|
|
37
37
|
return;
|
|
38
38
|
const awaitable = Array.from(promises);
|
|
39
39
|
return Promise.all(awaitable);
|
|
40
|
-
}
|
|
41
|
-
|
|
40
|
+
}
|
|
41
|
+
function rpc() {
|
|
42
42
|
const { rpc: rpc2 } = getWorkerState();
|
|
43
43
|
return new Proxy(rpc2, {
|
|
44
44
|
get(target, p, handler) {
|
|
@@ -56,6 +56,6 @@ const rpc = () => {
|
|
|
56
56
|
return safeSendCall;
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
|
|
61
61
|
export { rpcDone as a, rpc as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './
|
|
2
|
-
import { g as getWorkerState } from './
|
|
1
|
+
import './vendor-index.fad2598b.js';
|
|
2
|
+
import { g as getWorkerState } from './vendor-global.6795f91f.js';
|
|
3
3
|
|
|
4
4
|
const filesCount = /* @__PURE__ */ new Map();
|
|
5
5
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -25,4 +25,4 @@ function resetRunOnceCounter() {
|
|
|
25
25
|
filesCount.clear();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export {
|
|
28
|
+
export { runOnce as a, isFirstRun as i, resetRunOnceCounter as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setSafeTimers } from '@vitest/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { r as resetRunOnceCounter } from './vendor-run-once.69ce7172.js';
|
|
3
3
|
|
|
4
4
|
let globalSetup = false;
|
|
5
5
|
async function setupCommonEnv(config) {
|
|
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
|
|
|
10
10
|
globalSetup = true;
|
|
11
11
|
setSafeTimers();
|
|
12
12
|
if (config.globals)
|
|
13
|
-
(await import('./chunk-integrations-globals.
|
|
13
|
+
(await import('./chunk-integrations-globals.d419838f.js')).registerApiGlobally();
|
|
14
14
|
}
|
|
15
15
|
function setupDefines(defines) {
|
|
16
16
|
for (const key in defines)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getNames, getTests } from '@vitest/runner/utils';
|
|
2
|
+
import '@vitest/utils';
|
|
3
|
+
|
|
4
|
+
function hasFailedSnapshot(suite) {
|
|
5
|
+
return getTests(suite).some((s) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some((e) => e && e.message && e.message.match(/Snapshot .* mismatched/));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function getFullName(task, separator = " > ") {
|
|
11
|
+
return getNames(task).join(separator);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getFullName as g, hasFailedSnapshot as h };
|