vitest 0.29.6 → 0.29.8
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 +1 -185
- package/dist/browser.d.ts +12 -2
- package/dist/browser.js +5 -3
- package/dist/child.js +4 -5
- package/dist/{chunk-api-setup.ac7748ac.js → chunk-api-setup.3aabe9ac.js} +16 -7
- package/dist/{chunk-install-pkg.f38803ff.js → chunk-install-pkg.6aa7cf6d.js} +7 -6
- package/dist/{chunk-integrations-coverage.e0a6acd2.js → chunk-integrations-coverage.d93ee824.js} +5 -5
- package/dist/{chunk-integrations-globals.a473e88a.js → chunk-integrations-globals.49802775.js} +8 -7
- package/dist/{chunk-integrations-run-once.a2b4758b.js → chunk-integrations-run-once.ea614f17.js} +2 -1
- package/dist/{chunk-integrations-utils.d7c85bd9.js → chunk-integrations-utils.23c19408.js} +2 -2
- package/dist/{chunk-node-pkg.68fe5e35.js → chunk-node-pkg.30d8b37e.js} +155 -2330
- package/dist/{chunk-runtime-mocker.344fec90.js → chunk-runtime-mocker.3283818a.js} +3 -3
- package/dist/{chunk-runtime-rpc.1b5714dc.js → chunk-runtime-rpc.d6aa57f8.js} +1 -1
- package/dist/{chunk-runtime-setup.a49dc2f9.js → chunk-runtime-setup.5d504677.js} +2 -2
- package/dist/{chunk-utils-base.81f83dbd.js → chunk-utils-base.b5ddfcc9.js} +4 -1
- package/dist/{chunk-utils-env.04ffbef7.js → chunk-utils-env.6b856dbf.js} +2 -8
- package/dist/chunk-utils-global.fd174983.js +8 -0
- package/dist/{chunk-utils-import.39ffe9c5.js → chunk-utils-import.e488ace3.js} +194 -195
- package/dist/{chunk-utils-tasks.b41c8284.js → chunk-utils-tasks.8781fd71.js} +2 -2
- package/dist/cli.js +7 -6
- package/dist/config.cjs +0 -5
- package/dist/config.d.ts +1 -5
- package/dist/config.js +0 -5
- package/dist/coverage.d.ts +1 -1
- package/dist/entry.js +11 -10
- package/dist/environments.d.ts +1 -1
- package/dist/index.d.ts +8 -13
- package/dist/index.js +9 -8
- package/dist/loader.js +2 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.js +9 -8
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +6 -5
- package/dist/{types-fafda418.d.ts → types-94cfe4b4.d.ts} +23 -16
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/dist/worker.js +7 -8
- package/package.json +18 -7
- package/utils.d.ts +1 -0
|
@@ -4,13 +4,13 @@ import { isInternalRequest, isPrimitive } from 'vite-node/utils';
|
|
|
4
4
|
import { isAbsolute, dirname, join, basename, extname, resolve, normalize, relative } from 'pathe';
|
|
5
5
|
import { i as isNodeBuiltin } from './vendor-index.bdee400f.js';
|
|
6
6
|
import { processError } from '@vitest/runner/utils';
|
|
7
|
-
import { g as getWorkerState,
|
|
7
|
+
import { g as getWorkerState, a as getCurrentEnvironment } from './chunk-utils-global.fd174983.js';
|
|
8
8
|
import { d as distDir } from './chunk-paths.e36446b4.js';
|
|
9
9
|
import { existsSync, readdirSync } from 'node:fs';
|
|
10
10
|
import { getColors, getType } from '@vitest/utils';
|
|
11
|
-
import {
|
|
11
|
+
import { f as getAllMockableProperties } from './chunk-utils-base.b5ddfcc9.js';
|
|
12
12
|
import { spyOn } from '@vitest/spy';
|
|
13
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
13
|
+
import { r as rpc } from './chunk-runtime-rpc.d6aa57f8.js';
|
|
14
14
|
|
|
15
15
|
const filterPublicKeys = ["__esModule", Symbol.asyncIterator, Symbol.hasInstance, Symbol.isConcatSpreadable, Symbol.iterator, Symbol.match, Symbol.matchAll, Symbol.replace, Symbol.search, Symbol.split, Symbol.species, Symbol.toPrimitive, Symbol.toStringTag, Symbol.unscopables];
|
|
16
16
|
class RefTracker {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setSafeTimers } from '@vitest/utils';
|
|
2
|
-
import { a as resetRunOnceCounter } from './chunk-integrations-run-once.
|
|
2
|
+
import { a as resetRunOnceCounter } from './chunk-integrations-run-once.ea614f17.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.49802775.js')).registerApiGlobally();
|
|
14
14
|
}
|
|
15
15
|
function setupDefines(defines) {
|
|
16
16
|
for (const key in defines)
|
|
@@ -14,6 +14,9 @@ function groupBy(collection, iteratee) {
|
|
|
14
14
|
return acc;
|
|
15
15
|
}, {});
|
|
16
16
|
}
|
|
17
|
+
function isPrimitive(value) {
|
|
18
|
+
return value === null || typeof value !== "function" && typeof value !== "object";
|
|
19
|
+
}
|
|
17
20
|
function getAllMockableProperties(obj, isModule) {
|
|
18
21
|
const allProps = /* @__PURE__ */ new Map();
|
|
19
22
|
let curr = obj;
|
|
@@ -85,4 +88,4 @@ function getEnvironmentTransformMode(config, environment) {
|
|
|
85
88
|
return environment === "happy-dom" || environment === "jsdom" ? "web" : "ssr";
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
export {
|
|
91
|
+
export { isPrimitive as a, getEnvironmentTransformMode as b, noop as c, deepMerge as d, stdout as e, getAllMockableProperties as f, groupBy as g, isObject as i, notNullish as n, slash as s, toArray as t };
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { relative } from 'pathe';
|
|
2
2
|
import 'std-env';
|
|
3
3
|
import '@vitest/runner/utils';
|
|
4
|
+
import { g as getWorkerState } from './chunk-utils-global.fd174983.js';
|
|
4
5
|
import '@vitest/utils';
|
|
5
6
|
|
|
6
7
|
var _a;
|
|
7
8
|
const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a = process.versions) == null ? void 0 : _a.deno) && !globalThis.window;
|
|
8
9
|
|
|
9
|
-
function getWorkerState() {
|
|
10
|
-
return globalThis.__vitest_worker__;
|
|
11
|
-
}
|
|
12
|
-
function getCurrentEnvironment() {
|
|
13
|
-
return globalThis.__vitest_environment__;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
10
|
const isWindows = isNode && process.platform === "win32";
|
|
17
11
|
const getRunMode = () => getWorkerState().config.mode;
|
|
18
12
|
const isRunningInBenchmark = () => getRunMode() === "benchmark";
|
|
@@ -67,4 +61,4 @@ function getCallLastIndex(code) {
|
|
|
67
61
|
return null;
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
export {
|
|
64
|
+
export { isNode as a, relativePath as b, removeUndefinedValues as c, isWindows as d, getCallLastIndex as g, isRunningInBenchmark as i, resetModules as r };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { getCurrentSuite } from '@vitest/runner';
|
|
2
2
|
import { createChainable, getNames } from '@vitest/runner/utils';
|
|
3
3
|
import { getSafeTimers, noop, createSimpleStackTrace } from '@vitest/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { i as isRunningInBenchmark, g as getCallLastIndex, r as resetModules } from './chunk-utils-env.6b856dbf.js';
|
|
5
5
|
import * as chai$1 from 'chai';
|
|
6
6
|
import { expect } from 'chai';
|
|
7
7
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
8
8
|
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect';
|
|
9
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
9
|
+
import { r as rpc } from './chunk-runtime-rpc.d6aa57f8.js';
|
|
10
10
|
import { join, dirname } from 'pathe';
|
|
11
11
|
import { g as getSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js';
|
|
12
|
-
import { i as isObject } from './chunk-utils-base.
|
|
13
|
-
import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, a as parseErrorStacktrace, g as getFullName, b as parseSingleStack } from './chunk-utils-tasks.
|
|
12
|
+
import { i as isObject } from './chunk-utils-base.b5ddfcc9.js';
|
|
13
|
+
import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, a as parseErrorStacktrace, g as getFullName, b as parseSingleStack } from './chunk-utils-tasks.8781fd71.js';
|
|
14
|
+
import { g as getWorkerState, a as getCurrentEnvironment } from './chunk-utils-global.fd174983.js';
|
|
14
15
|
import require$$0 from 'util';
|
|
15
16
|
import { spyOn, fn, isMockFunction, spies } from '@vitest/spy';
|
|
16
17
|
|
|
@@ -5989,205 +5990,203 @@ class FakeTimers {
|
|
|
5989
5990
|
}
|
|
5990
5991
|
}
|
|
5991
5992
|
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
this._config = null;
|
|
5999
|
-
this._mocker = typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : null;
|
|
6000
|
-
this._mockedDate = null;
|
|
6001
|
-
if (!this._mocker) {
|
|
6002
|
-
const errorMsg = `Vitest was initialized with native Node instead of Vite Node.
|
|
6003
|
-
|
|
6004
|
-
It's possible that you are importing "vitest" directly inside "globalSetup". In that case, use "setupFiles" because "globalSetup" runs in a different context.
|
|
6005
|
-
Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
|
|
6006
|
-
`;
|
|
6007
|
-
throw new Error(errorMsg);
|
|
6008
|
-
}
|
|
6009
|
-
const workerState = getWorkerState();
|
|
6010
|
-
this._timers = new FakeTimers({
|
|
6011
|
-
global: globalThis,
|
|
6012
|
-
config: workerState.config.fakeTimers
|
|
6013
|
-
});
|
|
6014
|
-
}
|
|
6015
|
-
useFakeTimers(config) {
|
|
6016
|
-
if (config) {
|
|
6017
|
-
this._timers.configure(config);
|
|
6018
|
-
} else {
|
|
6019
|
-
const workerState = getWorkerState();
|
|
6020
|
-
this._timers.configure(workerState.config.fakeTimers);
|
|
5993
|
+
function createVitest() {
|
|
5994
|
+
const _mocker = typeof __vitest_mocker__ !== "undefined" ? __vitest_mocker__ : new Proxy({}, {
|
|
5995
|
+
get(name) {
|
|
5996
|
+
throw new Error(
|
|
5997
|
+
`Vitest mocker was not initialized in this environment. vi.${name}() is forbidden.`
|
|
5998
|
+
);
|
|
6021
5999
|
}
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
}
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
}
|
|
6034
|
-
async runOnlyPendingTimersAsync() {
|
|
6035
|
-
await this._timers.runOnlyPendingTimersAsync();
|
|
6036
|
-
return this;
|
|
6037
|
-
}
|
|
6038
|
-
runAllTimers() {
|
|
6039
|
-
this._timers.runAllTimers();
|
|
6040
|
-
return this;
|
|
6041
|
-
}
|
|
6042
|
-
async runAllTimersAsync() {
|
|
6043
|
-
await this._timers.runAllTimersAsync();
|
|
6044
|
-
return this;
|
|
6045
|
-
}
|
|
6046
|
-
runAllTicks() {
|
|
6047
|
-
this._timers.runAllTicks();
|
|
6048
|
-
return this;
|
|
6049
|
-
}
|
|
6050
|
-
advanceTimersByTime(ms) {
|
|
6051
|
-
this._timers.advanceTimersByTime(ms);
|
|
6052
|
-
return this;
|
|
6053
|
-
}
|
|
6054
|
-
async advanceTimersByTimeAsync(ms) {
|
|
6055
|
-
await this._timers.advanceTimersByTimeAsync(ms);
|
|
6056
|
-
return this;
|
|
6057
|
-
}
|
|
6058
|
-
advanceTimersToNextTimer() {
|
|
6059
|
-
this._timers.advanceTimersToNextTimer();
|
|
6060
|
-
return this;
|
|
6061
|
-
}
|
|
6062
|
-
async advanceTimersToNextTimerAsync() {
|
|
6063
|
-
await this._timers.advanceTimersToNextTimerAsync();
|
|
6064
|
-
return this;
|
|
6065
|
-
}
|
|
6066
|
-
getTimerCount() {
|
|
6067
|
-
return this._timers.getTimerCount();
|
|
6068
|
-
}
|
|
6069
|
-
setSystemTime(time) {
|
|
6070
|
-
const date = time instanceof Date ? time : new Date(time);
|
|
6071
|
-
this._mockedDate = date;
|
|
6072
|
-
this._timers.setSystemTime(date);
|
|
6073
|
-
return this;
|
|
6074
|
-
}
|
|
6075
|
-
getMockedSystemTime() {
|
|
6076
|
-
return this._mockedDate;
|
|
6077
|
-
}
|
|
6078
|
-
getRealSystemTime() {
|
|
6079
|
-
return this._timers.getRealSystemTime();
|
|
6080
|
-
}
|
|
6081
|
-
clearAllTimers() {
|
|
6082
|
-
this._timers.clearAllTimers();
|
|
6083
|
-
return this;
|
|
6084
|
-
}
|
|
6085
|
-
getImporter() {
|
|
6000
|
+
});
|
|
6001
|
+
let _mockedDate = null;
|
|
6002
|
+
let _config = null;
|
|
6003
|
+
const workerState = getWorkerState();
|
|
6004
|
+
const _timers = new FakeTimers({
|
|
6005
|
+
global: globalThis,
|
|
6006
|
+
config: workerState.config.fakeTimers
|
|
6007
|
+
});
|
|
6008
|
+
const _stubsGlobal = /* @__PURE__ */ new Map();
|
|
6009
|
+
const _stubsEnv = /* @__PURE__ */ new Map();
|
|
6010
|
+
const getImporter = () => {
|
|
6086
6011
|
const stackTrace = createSimpleStackTrace({ stackTraceLimit: 4 });
|
|
6087
6012
|
const importerStack = stackTrace.split("\n")[4];
|
|
6088
6013
|
const stack = parseSingleStack(importerStack);
|
|
6089
6014
|
return (stack == null ? void 0 : stack.file) || "";
|
|
6090
|
-
}
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6015
|
+
};
|
|
6016
|
+
return {
|
|
6017
|
+
useFakeTimers(config) {
|
|
6018
|
+
if (config) {
|
|
6019
|
+
_timers.configure(config);
|
|
6020
|
+
} else {
|
|
6021
|
+
const workerState2 = getWorkerState();
|
|
6022
|
+
_timers.configure(workerState2.config.fakeTimers);
|
|
6023
|
+
}
|
|
6024
|
+
_timers.useFakeTimers();
|
|
6025
|
+
return this;
|
|
6026
|
+
},
|
|
6027
|
+
useRealTimers() {
|
|
6028
|
+
_timers.useRealTimers();
|
|
6029
|
+
_mockedDate = null;
|
|
6030
|
+
return this;
|
|
6031
|
+
},
|
|
6032
|
+
runOnlyPendingTimers() {
|
|
6033
|
+
_timers.runOnlyPendingTimers();
|
|
6034
|
+
return this;
|
|
6035
|
+
},
|
|
6036
|
+
async runOnlyPendingTimersAsync() {
|
|
6037
|
+
await _timers.runOnlyPendingTimersAsync();
|
|
6038
|
+
return this;
|
|
6039
|
+
},
|
|
6040
|
+
runAllTimers() {
|
|
6041
|
+
_timers.runAllTimers();
|
|
6042
|
+
return this;
|
|
6043
|
+
},
|
|
6044
|
+
async runAllTimersAsync() {
|
|
6045
|
+
await _timers.runAllTimersAsync();
|
|
6046
|
+
return this;
|
|
6047
|
+
},
|
|
6048
|
+
runAllTicks() {
|
|
6049
|
+
_timers.runAllTicks();
|
|
6050
|
+
return this;
|
|
6051
|
+
},
|
|
6052
|
+
advanceTimersByTime(ms) {
|
|
6053
|
+
_timers.advanceTimersByTime(ms);
|
|
6054
|
+
return this;
|
|
6055
|
+
},
|
|
6056
|
+
async advanceTimersByTimeAsync(ms) {
|
|
6057
|
+
await _timers.advanceTimersByTimeAsync(ms);
|
|
6058
|
+
return this;
|
|
6059
|
+
},
|
|
6060
|
+
advanceTimersToNextTimer() {
|
|
6061
|
+
_timers.advanceTimersToNextTimer();
|
|
6062
|
+
return this;
|
|
6063
|
+
},
|
|
6064
|
+
async advanceTimersToNextTimerAsync() {
|
|
6065
|
+
await _timers.advanceTimersToNextTimerAsync();
|
|
6066
|
+
return this;
|
|
6067
|
+
},
|
|
6068
|
+
getTimerCount() {
|
|
6069
|
+
return _timers.getTimerCount();
|
|
6070
|
+
},
|
|
6071
|
+
setSystemTime(time) {
|
|
6072
|
+
const date = time instanceof Date ? time : new Date(time);
|
|
6073
|
+
_mockedDate = date;
|
|
6074
|
+
_timers.setSystemTime(date);
|
|
6075
|
+
return this;
|
|
6076
|
+
},
|
|
6077
|
+
getMockedSystemTime() {
|
|
6078
|
+
return _mockedDate;
|
|
6079
|
+
},
|
|
6080
|
+
getRealSystemTime() {
|
|
6081
|
+
return _timers.getRealSystemTime();
|
|
6082
|
+
},
|
|
6083
|
+
clearAllTimers() {
|
|
6084
|
+
_timers.clearAllTimers();
|
|
6085
|
+
return this;
|
|
6086
|
+
},
|
|
6087
|
+
spyOn,
|
|
6088
|
+
fn,
|
|
6089
|
+
mock(path, factory) {
|
|
6090
|
+
const importer = getImporter();
|
|
6091
|
+
_mocker.queueMock(
|
|
6092
|
+
path,
|
|
6093
|
+
importer,
|
|
6094
|
+
factory ? () => factory(() => _mocker.importActual(path, importer)) : void 0
|
|
6095
|
+
);
|
|
6096
|
+
},
|
|
6097
|
+
unmock(path) {
|
|
6098
|
+
_mocker.queueUnmock(path, getImporter());
|
|
6099
|
+
},
|
|
6100
|
+
doMock(path, factory) {
|
|
6101
|
+
_mocker.queueMock(path, getImporter(), factory);
|
|
6102
|
+
},
|
|
6103
|
+
doUnmock(path) {
|
|
6104
|
+
_mocker.queueUnmock(path, getImporter());
|
|
6105
|
+
},
|
|
6106
|
+
async importActual(path) {
|
|
6107
|
+
return _mocker.importActual(path, getImporter());
|
|
6108
|
+
},
|
|
6109
|
+
async importMock(path) {
|
|
6110
|
+
return _mocker.importMock(path, getImporter());
|
|
6111
|
+
},
|
|
6112
|
+
mocked(item, _options = {}) {
|
|
6113
|
+
return item;
|
|
6114
|
+
},
|
|
6115
|
+
isMockFunction(fn2) {
|
|
6116
|
+
return isMockFunction(fn2);
|
|
6117
|
+
},
|
|
6118
|
+
clearAllMocks() {
|
|
6119
|
+
spies.forEach((spy) => spy.mockClear());
|
|
6120
|
+
return this;
|
|
6121
|
+
},
|
|
6122
|
+
resetAllMocks() {
|
|
6123
|
+
spies.forEach((spy) => spy.mockReset());
|
|
6124
|
+
return this;
|
|
6125
|
+
},
|
|
6126
|
+
restoreAllMocks() {
|
|
6127
|
+
spies.forEach((spy) => spy.mockRestore());
|
|
6128
|
+
return this;
|
|
6129
|
+
},
|
|
6130
|
+
stubGlobal(name, value) {
|
|
6131
|
+
if (!_stubsGlobal.has(name))
|
|
6132
|
+
_stubsGlobal.set(name, Object.getOwnPropertyDescriptor(globalThis, name));
|
|
6133
|
+
Object.defineProperty(globalThis, name, {
|
|
6134
|
+
value,
|
|
6135
|
+
writable: true,
|
|
6136
|
+
configurable: true,
|
|
6137
|
+
enumerable: true
|
|
6138
|
+
});
|
|
6139
|
+
return this;
|
|
6140
|
+
},
|
|
6141
|
+
stubEnv(name, value) {
|
|
6142
|
+
if (!_stubsEnv.has(name))
|
|
6143
|
+
_stubsEnv.set(name, process.env[name]);
|
|
6144
|
+
process.env[name] = value;
|
|
6145
|
+
return this;
|
|
6146
|
+
},
|
|
6147
|
+
unstubAllGlobals() {
|
|
6148
|
+
_stubsGlobal.forEach((original, name) => {
|
|
6149
|
+
if (!original)
|
|
6150
|
+
Reflect.deleteProperty(globalThis, name);
|
|
6151
|
+
else
|
|
6152
|
+
Object.defineProperty(globalThis, name, original);
|
|
6153
|
+
});
|
|
6154
|
+
_stubsGlobal.clear();
|
|
6155
|
+
return this;
|
|
6156
|
+
},
|
|
6157
|
+
unstubAllEnvs() {
|
|
6158
|
+
_stubsEnv.forEach((original, name) => {
|
|
6159
|
+
if (original === void 0)
|
|
6160
|
+
delete process.env[name];
|
|
6161
|
+
else
|
|
6162
|
+
process.env[name] = original;
|
|
6163
|
+
});
|
|
6164
|
+
_stubsEnv.clear();
|
|
6165
|
+
return this;
|
|
6166
|
+
},
|
|
6167
|
+
resetModules() {
|
|
6185
6168
|
const state = getWorkerState();
|
|
6186
|
-
|
|
6169
|
+
resetModules(state.moduleCache);
|
|
6170
|
+
return this;
|
|
6171
|
+
},
|
|
6172
|
+
async dynamicImportSettled() {
|
|
6173
|
+
return waitForImportsToResolve();
|
|
6174
|
+
},
|
|
6175
|
+
setConfig(config) {
|
|
6176
|
+
const state = getWorkerState();
|
|
6177
|
+
if (!_config)
|
|
6178
|
+
_config = { ...state.config };
|
|
6179
|
+
Object.assign(state.config, config);
|
|
6180
|
+
},
|
|
6181
|
+
resetConfig() {
|
|
6182
|
+
if (_config) {
|
|
6183
|
+
const state = getWorkerState();
|
|
6184
|
+
Object.assign(state.config, _config);
|
|
6185
|
+
}
|
|
6187
6186
|
}
|
|
6188
|
-
}
|
|
6187
|
+
};
|
|
6189
6188
|
}
|
|
6190
|
-
const vitest =
|
|
6189
|
+
const vitest = createVitest();
|
|
6191
6190
|
const vi = vitest;
|
|
6192
6191
|
|
|
6193
6192
|
export { RealDate as R, vi as a, bench as b, createExpect as c, getSnapshotClient as d, getBenchOptions as e, getBenchFn as f, globalExpect as g, vitest as v };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getNames, getTests } from '@vitest/runner/utils';
|
|
2
2
|
import { resolve } from 'pathe';
|
|
3
|
-
import { n as notNullish } from './chunk-utils-base.
|
|
3
|
+
import { a as isPrimitive, n as notNullish } from './chunk-utils-base.b5ddfcc9.js';
|
|
4
4
|
|
|
5
5
|
function hasFailedSnapshot(suite) {
|
|
6
6
|
return getTests(suite).some((s) => {
|
|
@@ -68,7 +68,7 @@ function parseStacktrace(stack, full = false) {
|
|
|
68
68
|
return stackFrames;
|
|
69
69
|
}
|
|
70
70
|
function parseErrorStacktrace(e, full = false) {
|
|
71
|
-
if (!e)
|
|
71
|
+
if (!e || isPrimitive(e))
|
|
72
72
|
return [];
|
|
73
73
|
if (e.stacks)
|
|
74
74
|
return e.stacks;
|
package/dist/cli.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.
|
|
4
|
+
import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.30d8b37e.js';
|
|
5
5
|
import './chunk-constants.bc18a549.js';
|
|
6
|
-
import './chunk-integrations-coverage.
|
|
7
|
-
import 'local-pkg';
|
|
6
|
+
import './chunk-integrations-coverage.d93ee824.js';
|
|
8
7
|
import './chunk-env-node.affdd278.js';
|
|
9
8
|
import 'node:console';
|
|
10
|
-
import '
|
|
9
|
+
import 'local-pkg';
|
|
10
|
+
import './chunk-utils-env.6b856dbf.js';
|
|
11
11
|
import 'std-env';
|
|
12
12
|
import '@vitest/runner/utils';
|
|
13
|
+
import './chunk-utils-global.fd174983.js';
|
|
13
14
|
import '@vitest/utils';
|
|
14
15
|
import 'vite';
|
|
15
16
|
import 'node:path';
|
|
@@ -37,7 +38,7 @@ import 'source-map';
|
|
|
37
38
|
import 'module';
|
|
38
39
|
import 'acorn';
|
|
39
40
|
import 'acorn-walk';
|
|
40
|
-
import './chunk-utils-base.
|
|
41
|
+
import './chunk-utils-base.b5ddfcc9.js';
|
|
41
42
|
import 'crypto';
|
|
42
43
|
import './chunk-paths.e36446b4.js';
|
|
43
44
|
import 'node:v8';
|
|
@@ -45,7 +46,7 @@ import './vendor-index.783e7f3e.js';
|
|
|
45
46
|
import 'node:worker_threads';
|
|
46
47
|
import 'tinypool';
|
|
47
48
|
import 'perf_hooks';
|
|
48
|
-
import './chunk-utils-tasks.
|
|
49
|
+
import './chunk-utils-tasks.8781fd71.js';
|
|
49
50
|
import '@vitest/utils/diff';
|
|
50
51
|
import 'vite-node/server';
|
|
51
52
|
import './vendor-magic-string.es.b3bc5745.js';
|
package/dist/config.cjs
CHANGED
|
@@ -33,10 +33,6 @@ const coverageConfigDefaults = {
|
|
|
33
33
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
34
34
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
35
35
|
};
|
|
36
|
-
const browserConfigDefaults = {
|
|
37
|
-
enabled: false,
|
|
38
|
-
headless: stdEnv.isCI
|
|
39
|
-
};
|
|
40
36
|
const fakeTimersDefaults = {
|
|
41
37
|
loopLimit: 1e4,
|
|
42
38
|
shouldClearNativeTimers: true,
|
|
@@ -65,7 +61,6 @@ const config = {
|
|
|
65
61
|
hookTimeout: 1e4,
|
|
66
62
|
teardownTimeout: 1e4,
|
|
67
63
|
isolate: true,
|
|
68
|
-
browser: browserConfigDefaults,
|
|
69
64
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
70
65
|
forceRerunTriggers: [
|
|
71
66
|
"**/package.json/**",
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
|
|
2
2
|
export { ConfigEnv } from 'vite';
|
|
3
|
-
import { a1 as ResolvedCoverageOptions,
|
|
3
|
+
import { a1 as ResolvedCoverageOptions, n as UserConfig$1, a4 as CoverageC8Options, a5 as CustomProviderOptions, a3 as CoverageIstanbulOptions, af as HtmlOptions, ag as FileOptions, ah as CloverOptions, ai as CoberturaOptions, aj as HtmlSpaOptions, ak as LcovOptions, al as LcovOnlyOptions, am as TeamcityOptions, an as TextOptions, ao as ProjectOptions, F as FakeTimerInstallOpts } from './types-94cfe4b4.js';
|
|
4
4
|
import '@vitest/expect';
|
|
5
5
|
import '@vitest/runner';
|
|
6
6
|
import '@vitest/runner/types';
|
|
@@ -32,10 +32,6 @@ declare const config: {
|
|
|
32
32
|
hookTimeout: number;
|
|
33
33
|
teardownTimeout: number;
|
|
34
34
|
isolate: boolean;
|
|
35
|
-
browser: {
|
|
36
|
-
readonly enabled: false;
|
|
37
|
-
readonly headless: boolean;
|
|
38
|
-
};
|
|
39
35
|
watchExclude: string[];
|
|
40
36
|
forceRerunTriggers: string[];
|
|
41
37
|
update: boolean;
|
package/dist/config.js
CHANGED
|
@@ -29,10 +29,6 @@ const coverageConfigDefaults = {
|
|
|
29
29
|
reporter: [["text", {}], ["html", {}], ["clover", {}], ["json", {}]],
|
|
30
30
|
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte"]
|
|
31
31
|
};
|
|
32
|
-
const browserConfigDefaults = {
|
|
33
|
-
enabled: false,
|
|
34
|
-
headless: isCI
|
|
35
|
-
};
|
|
36
32
|
const fakeTimersDefaults = {
|
|
37
33
|
loopLimit: 1e4,
|
|
38
34
|
shouldClearNativeTimers: true,
|
|
@@ -61,7 +57,6 @@ const config = {
|
|
|
61
57
|
hookTimeout: 1e4,
|
|
62
58
|
teardownTimeout: 1e4,
|
|
63
59
|
isolate: true,
|
|
64
|
-
browser: browserConfigDefaults,
|
|
65
60
|
watchExclude: ["**/node_modules/**", "**/dist/**"],
|
|
66
61
|
forceRerunTriggers: [
|
|
67
62
|
"**/package.json/**",
|
package/dist/coverage.d.ts
CHANGED