vitest 2.0.0-beta.2 → 2.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/dist/browser.d.ts +5 -1
- package/dist/browser.js +18 -2
- package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.BK0Cn4q1.js} +3 -4
- package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.DiVMr5d4.js} +54 -24
- package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.C-Bkopka.js} +5 -6
- package/dist/cli.js +2 -2
- package/dist/config.cjs +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/coverage.d.ts +1 -1
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +1 -1
- package/dist/index-C7JhjWOq.d.ts +1565 -0
- package/dist/index.d.ts +6 -1445
- package/dist/index.js +3 -4
- package/dist/node.d.ts +3 -6
- package/dist/node.js +7 -7
- package/dist/{reporters-DFgqsvtL.d.ts → reporters-qky6mwBH.d.ts} +398 -195
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +4 -4
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +9 -1
- package/dist/{suite-C_sqQjdz.d.ts → suite-B5_jYIf8.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{base.VFkIJ66g.js → base.D4XK-wRp.js} +2 -2
- package/dist/vendor/{cac.CtP0aXu-.js → cac.sXjWMctD.js} +58 -20
- package/dist/vendor/{cli-api.B2QW76dQ.js → cli-api.BH9TJcYU.js} +487 -357
- package/dist/vendor/{constants.5SOfHUj0.js → constants.TCjCaw2D.js} +4 -3
- package/dist/vendor/{execute.CLLNVNnK.js → execute.BHj6OMh4.js} +3 -3
- package/dist/vendor/{index.CRxYS9H3.js → index.CyGfDRbW.js} +266 -49
- package/dist/vendor/{index.BfoZyXD1.js → index.DHRpy7zp.js} +1 -1
- package/dist/vendor/{index.CmILuxzC.js → index.DwR86H5i.js} +26 -3
- package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.BhJvzjns.js} +2 -2
- package/dist/vendor/{utils.D5gGkwyH.js → utils.YuQ3LT2a.js} +1 -1
- package/dist/vendor/{vi.ClD3hi7L.js → vi.C6AfDXK6.js} +97 -46
- package/dist/vendor/{vm.Bi3bljci.js → vm.Ow-X2mkS.js} +2 -2
- package/dist/workers/forks.js +2 -2
- package/dist/workers/runVmTests.js +4 -5
- package/dist/workers/threads.js +2 -2
- package/dist/workers/vmForks.js +3 -3
- package/dist/workers/vmThreads.js +3 -3
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +4 -4
- package/package.json +10 -10
- package/dist/vendor/run-once.DLomgGUH.js +0 -27
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as chai$1 from 'chai';
|
|
2
2
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.BFTU3MAI.js';
|
|
3
|
-
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT
|
|
3
|
+
import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters } from '@vitest/expect';
|
|
4
4
|
import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot';
|
|
5
5
|
import { getNames } from '@vitest/runner/utils';
|
|
6
6
|
import '@vitest/utils/error';
|
|
@@ -8,6 +8,8 @@ import { getCurrentTest } from '@vitest/runner';
|
|
|
8
8
|
import { g as getTestName } from './tasks.WC7M-K-v.js';
|
|
9
9
|
import { g as getWorkerState, a as getCurrentEnvironment } from './global.7bFbnyXl.js';
|
|
10
10
|
import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
|
|
11
|
+
import 'pathe';
|
|
12
|
+
import './env.bmJgw1qP.js';
|
|
11
13
|
import { parseSingleStack } from '@vitest/utils/source-map';
|
|
12
14
|
import { i as isChildProcess } from './base._gnK9Slw.js';
|
|
13
15
|
import { R as RealDate, r as resetDate, m as mockDate } from './date.BKM1wewY.js';
|
|
@@ -142,32 +144,6 @@ var chaiSubset = {exports: {}};
|
|
|
142
144
|
var chaiSubsetExports = chaiSubset.exports;
|
|
143
145
|
var Subset = /*@__PURE__*/getDefaultExportFromCjs(chaiSubsetExports);
|
|
144
146
|
|
|
145
|
-
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
146
|
-
const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
147
|
-
const GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
148
|
-
const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for("asymmetric-matchers-object");
|
|
149
|
-
|
|
150
|
-
if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
151
|
-
const globalState = /* @__PURE__ */ new WeakMap();
|
|
152
|
-
const matchers = /* @__PURE__ */ Object.create(null);
|
|
153
|
-
const customEqualityTesters = [];
|
|
154
|
-
const assymetricMatchers = /* @__PURE__ */ Object.create(null);
|
|
155
|
-
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
156
|
-
get: () => globalState
|
|
157
|
-
});
|
|
158
|
-
Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
|
|
159
|
-
configurable: true,
|
|
160
|
-
get: () => ({
|
|
161
|
-
state: globalState.get(globalThis[GLOBAL_EXPECT]),
|
|
162
|
-
matchers,
|
|
163
|
-
customEqualityTesters
|
|
164
|
-
})
|
|
165
|
-
});
|
|
166
|
-
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
|
|
167
|
-
get: () => assymetricMatchers
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
147
|
function recordAsyncExpect(test, promise) {
|
|
172
148
|
if (test && promise instanceof Promise) {
|
|
173
149
|
promise = promise.finally(() => {
|
|
@@ -359,10 +335,85 @@ chai$1.use(Subset);
|
|
|
359
335
|
chai$1.use(SnapshotPlugin);
|
|
360
336
|
chai$1.use(JestAsymmetricMatchers);
|
|
361
337
|
|
|
338
|
+
const unsupported = [
|
|
339
|
+
// .poll is meant to retry matchers until they succeed, and
|
|
340
|
+
// snapshots will always succeed as long as the poll method doesn't thow an error
|
|
341
|
+
// in this case using the `vi.waitFor` method is more appropriate
|
|
342
|
+
"matchSnapshot",
|
|
343
|
+
"toMatchSnapshot",
|
|
344
|
+
"toMatchInlineSnapshot",
|
|
345
|
+
"toThrowErrorMatchingSnapshot",
|
|
346
|
+
"toThrowErrorMatchingInlineSnapshot",
|
|
347
|
+
// toThrow will never succeed because we call the poll callback until it doesn't throw
|
|
348
|
+
"throws",
|
|
349
|
+
"Throw",
|
|
350
|
+
"throw",
|
|
351
|
+
"toThrow",
|
|
352
|
+
"toThrowError"
|
|
353
|
+
// these are not supported because you can call them without `.poll`,
|
|
354
|
+
// we throw an error inside the rejects/resolves methods to prevent this
|
|
355
|
+
// rejects,
|
|
356
|
+
// resolves
|
|
357
|
+
];
|
|
358
|
+
function createExpectPoll(expect) {
|
|
359
|
+
return function poll(fn, options = {}) {
|
|
360
|
+
var _a;
|
|
361
|
+
const state = getWorkerState();
|
|
362
|
+
const defaults = ((_a = state.config.expect) == null ? void 0 : _a.poll) ?? {};
|
|
363
|
+
const {
|
|
364
|
+
interval = defaults.interval ?? 50,
|
|
365
|
+
timeout = defaults.timeout ?? 1e3,
|
|
366
|
+
message
|
|
367
|
+
} = options;
|
|
368
|
+
const assertion = expect(null, message).withContext({ poll: true });
|
|
369
|
+
const proxy = new Proxy(assertion, {
|
|
370
|
+
get(target, key, receiver) {
|
|
371
|
+
const result = Reflect.get(target, key, receiver);
|
|
372
|
+
if (typeof result !== "function")
|
|
373
|
+
return result instanceof chai$1.Assertion ? proxy : result;
|
|
374
|
+
if (key === "assert")
|
|
375
|
+
return result;
|
|
376
|
+
if (typeof key === "string" && unsupported.includes(key))
|
|
377
|
+
throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`);
|
|
378
|
+
return function(...args) {
|
|
379
|
+
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
380
|
+
return new Promise((resolve, reject) => {
|
|
381
|
+
let intervalId;
|
|
382
|
+
let lastError;
|
|
383
|
+
const { setTimeout, clearTimeout } = getSafeTimers();
|
|
384
|
+
const timeoutId = setTimeout(() => {
|
|
385
|
+
clearTimeout(intervalId);
|
|
386
|
+
reject(copyStackTrace$1(new Error(`Matcher did not succeed in ${timeout}ms`, { cause: lastError }), STACK_TRACE_ERROR));
|
|
387
|
+
}, timeout);
|
|
388
|
+
const check = async () => {
|
|
389
|
+
try {
|
|
390
|
+
chai$1.util.flag(this, "object", await fn());
|
|
391
|
+
resolve(await result.call(this, ...args));
|
|
392
|
+
clearTimeout(intervalId);
|
|
393
|
+
clearTimeout(timeoutId);
|
|
394
|
+
} catch (err) {
|
|
395
|
+
lastError = err;
|
|
396
|
+
intervalId = setTimeout(check, interval);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
check();
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
return proxy;
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function copyStackTrace$1(target, source) {
|
|
408
|
+
if (source.stack !== void 0)
|
|
409
|
+
target.stack = source.stack.replace(source.message, target.message);
|
|
410
|
+
return target;
|
|
411
|
+
}
|
|
412
|
+
|
|
362
413
|
function createExpect(test) {
|
|
363
414
|
const expect = (value, message) => {
|
|
364
415
|
const { assertionCalls } = getState(expect);
|
|
365
|
-
setState({ assertionCalls: assertionCalls + 1
|
|
416
|
+
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
366
417
|
const assert2 = chai$1.expect(value, message);
|
|
367
418
|
const _test = test || getCurrentTest();
|
|
368
419
|
if (_test)
|
|
@@ -371,10 +422,10 @@ function createExpect(test) {
|
|
|
371
422
|
return assert2;
|
|
372
423
|
};
|
|
373
424
|
Object.assign(expect, chai$1.expect);
|
|
374
|
-
Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT
|
|
425
|
+
Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
|
|
375
426
|
expect.getState = () => getState(expect);
|
|
376
427
|
expect.setState = (state) => setState(state, expect);
|
|
377
|
-
const globalState = getState(globalThis[GLOBAL_EXPECT
|
|
428
|
+
const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
|
|
378
429
|
const testPath = getTestFile(test);
|
|
379
430
|
setState({
|
|
380
431
|
// this should also add "snapshotState" that is added conditionally
|
|
@@ -391,12 +442,9 @@ function createExpect(test) {
|
|
|
391
442
|
expect.extend = (matchers) => chai$1.expect.extend(expect, matchers);
|
|
392
443
|
expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters);
|
|
393
444
|
expect.soft = (...args) => {
|
|
394
|
-
|
|
395
|
-
expect.setState({
|
|
396
|
-
soft: true
|
|
397
|
-
});
|
|
398
|
-
return assert2;
|
|
445
|
+
return expect(...args).withContext({ soft: true });
|
|
399
446
|
};
|
|
447
|
+
expect.poll = createExpectPoll(expect);
|
|
400
448
|
expect.unreachable = (message) => {
|
|
401
449
|
chai$1.assert.fail(`expected${message ? ` "${message}" ` : " "}not to be reached`);
|
|
402
450
|
};
|
|
@@ -429,7 +477,7 @@ function getTestFile(test) {
|
|
|
429
477
|
return state.filepath;
|
|
430
478
|
}
|
|
431
479
|
const globalExpect = createExpect();
|
|
432
|
-
Object.defineProperty(globalThis, GLOBAL_EXPECT
|
|
480
|
+
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
433
481
|
value: globalExpect,
|
|
434
482
|
writable: true,
|
|
435
483
|
configurable: true
|
|
@@ -3343,10 +3391,13 @@ function createVitest() {
|
|
|
3343
3391
|
const _stubsGlobal = /* @__PURE__ */ new Map();
|
|
3344
3392
|
const _stubsEnv = /* @__PURE__ */ new Map();
|
|
3345
3393
|
const _envBooleans = ["PROD", "DEV", "SSR"];
|
|
3346
|
-
const getImporter = () => {
|
|
3347
|
-
const stackTrace = createSimpleStackTrace({ stackTraceLimit:
|
|
3348
|
-
const
|
|
3349
|
-
const
|
|
3394
|
+
const getImporter = (name) => {
|
|
3395
|
+
const stackTrace = createSimpleStackTrace({ stackTraceLimit: 5 });
|
|
3396
|
+
const stackArray = stackTrace.split("\n");
|
|
3397
|
+
const importerStackIndex = stackArray.findIndex((stack2) => {
|
|
3398
|
+
return stack2.includes(` at Object.${name}`) || stack2.includes(`${name}@`);
|
|
3399
|
+
});
|
|
3400
|
+
const stack = parseSingleStack(stackArray[importerStackIndex + 1]);
|
|
3350
3401
|
return (stack == null ? void 0 : stack.file) || "";
|
|
3351
3402
|
};
|
|
3352
3403
|
const utils = {
|
|
@@ -3441,7 +3492,7 @@ function createVitest() {
|
|
|
3441
3492
|
mock(path, factory) {
|
|
3442
3493
|
if (typeof path !== "string")
|
|
3443
3494
|
throw new Error(`vi.mock() expects a string path, but received a ${typeof path}`);
|
|
3444
|
-
const importer = getImporter();
|
|
3495
|
+
const importer = getImporter("mock");
|
|
3445
3496
|
_mocker.queueMock(
|
|
3446
3497
|
path,
|
|
3447
3498
|
importer,
|
|
@@ -3452,12 +3503,12 @@ function createVitest() {
|
|
|
3452
3503
|
unmock(path) {
|
|
3453
3504
|
if (typeof path !== "string")
|
|
3454
3505
|
throw new Error(`vi.unmock() expects a string path, but received a ${typeof path}`);
|
|
3455
|
-
_mocker.queueUnmock(path, getImporter());
|
|
3506
|
+
_mocker.queueUnmock(path, getImporter("unmock"));
|
|
3456
3507
|
},
|
|
3457
3508
|
doMock(path, factory) {
|
|
3458
3509
|
if (typeof path !== "string")
|
|
3459
3510
|
throw new Error(`vi.doMock() expects a string path, but received a ${typeof path}`);
|
|
3460
|
-
const importer = getImporter();
|
|
3511
|
+
const importer = getImporter("doMock");
|
|
3461
3512
|
_mocker.queueMock(
|
|
3462
3513
|
path,
|
|
3463
3514
|
importer,
|
|
@@ -3468,17 +3519,17 @@ function createVitest() {
|
|
|
3468
3519
|
doUnmock(path) {
|
|
3469
3520
|
if (typeof path !== "string")
|
|
3470
3521
|
throw new Error(`vi.doUnmock() expects a string path, but received a ${typeof path}`);
|
|
3471
|
-
_mocker.queueUnmock(path, getImporter());
|
|
3522
|
+
_mocker.queueUnmock(path, getImporter("doUnmock"));
|
|
3472
3523
|
},
|
|
3473
3524
|
async importActual(path) {
|
|
3474
3525
|
return _mocker.importActual(
|
|
3475
3526
|
path,
|
|
3476
|
-
getImporter(),
|
|
3527
|
+
getImporter("importActual"),
|
|
3477
3528
|
_mocker.getMockContext().callstack
|
|
3478
3529
|
);
|
|
3479
3530
|
},
|
|
3480
3531
|
async importMock(path) {
|
|
3481
|
-
return _mocker.importMock(path, getImporter());
|
|
3532
|
+
return _mocker.importMock(path, getImporter("importMock"));
|
|
3482
3533
|
},
|
|
3483
3534
|
// this is typed in the interface so it's not necessary to type it here
|
|
3484
3535
|
mocked(item, _options = {}) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import vm, { isContext } from 'node:vm';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, basename, extname, normalize, join, resolve } from 'pathe';
|
|
4
|
-
import { createCustomConsole } from '../chunks/runtime-console.
|
|
5
|
-
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.
|
|
4
|
+
import { createCustomConsole } from '../chunks/runtime-console.DiVMr5d4.js';
|
|
5
|
+
import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.BHj6OMh4.js';
|
|
6
6
|
import { distDir } from '../path.js';
|
|
7
7
|
import { dirname as dirname$1 } from 'node:path';
|
|
8
8
|
import { statSync, existsSync, promises, readFileSync } from 'node:fs';
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.CUjzkRH7.js';
|
|
3
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
3
|
+
import { r as runBaseTests } from '../vendor/base.D4XK-wRp.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
6
|
import '../vendor/global.7bFbnyXl.js';
|
|
7
|
-
import '../vendor/execute.
|
|
7
|
+
import '../vendor/execute.BHj6OMh4.js';
|
|
8
8
|
import 'node:vm';
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'node:fs';
|
|
@@ -6,11 +6,11 @@ import { performance } from 'node:perf_hooks';
|
|
|
6
6
|
import { startTests } from '@vitest/runner';
|
|
7
7
|
import { setupColors, createColors } from '@vitest/utils';
|
|
8
8
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
9
|
-
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.
|
|
9
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../vendor/index.DHRpy7zp.js';
|
|
10
10
|
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../vendor/coverage.ChSqD-qS.js';
|
|
11
11
|
import { g as getWorkerState } from '../vendor/global.7bFbnyXl.js';
|
|
12
|
-
import { V as VitestIndex } from '../vendor/index.
|
|
13
|
-
import { s as setupCommonEnv } from '../vendor/setup-common.
|
|
12
|
+
import { V as VitestIndex } from '../vendor/index.DwR86H5i.js';
|
|
13
|
+
import { s as setupCommonEnv } from '../vendor/setup-common.BhJvzjns.js';
|
|
14
14
|
import { c as closeInspector } from '../vendor/inspector.hPQncR7V.js';
|
|
15
15
|
import 'chai';
|
|
16
16
|
import 'pathe';
|
|
@@ -23,8 +23,7 @@ import '@vitest/runner/utils';
|
|
|
23
23
|
import '../vendor/index._7XLd8Kd.js';
|
|
24
24
|
import '../vendor/env.bmJgw1qP.js';
|
|
25
25
|
import 'std-env';
|
|
26
|
-
import '../vendor/
|
|
27
|
-
import '../vendor/vi.ClD3hi7L.js';
|
|
26
|
+
import '../vendor/vi.C6AfDXK6.js';
|
|
28
27
|
import '../vendor/_commonjsHelpers.BFTU3MAI.js';
|
|
29
28
|
import '@vitest/expect';
|
|
30
29
|
import '@vitest/snapshot';
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../vendor/base.
|
|
1
|
+
import { r as runBaseTests } from '../vendor/base.D4XK-wRp.js';
|
|
2
2
|
import { a as createThreadsRpcOptions } from '../vendor/utils.CUjzkRH7.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
4
|
import '../vendor/global.7bFbnyXl.js';
|
|
5
|
-
import '../vendor/execute.
|
|
5
|
+
import '../vendor/execute.BHj6OMh4.js';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:fs';
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../vendor/utils.CUjzkRH7.js';
|
|
3
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
3
|
+
import { r as runVmTests } from '../vendor/vm.Ow-X2mkS.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'node:vm';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import 'pathe';
|
|
8
|
-
import '../chunks/runtime-console.
|
|
8
|
+
import '../chunks/runtime-console.DiVMr5d4.js';
|
|
9
9
|
import 'node:stream';
|
|
10
10
|
import 'node:console';
|
|
11
11
|
import 'node:path';
|
|
@@ -14,7 +14,7 @@ import '@vitest/runner/utils';
|
|
|
14
14
|
import '../vendor/global.7bFbnyXl.js';
|
|
15
15
|
import '../vendor/env.bmJgw1qP.js';
|
|
16
16
|
import 'std-env';
|
|
17
|
-
import '../vendor/execute.
|
|
17
|
+
import '../vendor/execute.BHj6OMh4.js';
|
|
18
18
|
import 'node:fs';
|
|
19
19
|
import 'vite-node/client';
|
|
20
20
|
import 'vite-node/utils';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as createThreadsRpcOptions } from '../vendor/utils.CUjzkRH7.js';
|
|
2
|
-
import { r as runVmTests } from '../vendor/vm.
|
|
2
|
+
import { r as runVmTests } from '../vendor/vm.Ow-X2mkS.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import 'node:vm';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'pathe';
|
|
7
|
-
import '../chunks/runtime-console.
|
|
7
|
+
import '../chunks/runtime-console.DiVMr5d4.js';
|
|
8
8
|
import 'node:stream';
|
|
9
9
|
import 'node:console';
|
|
10
10
|
import 'node:path';
|
|
@@ -13,7 +13,7 @@ import '@vitest/runner/utils';
|
|
|
13
13
|
import '../vendor/global.7bFbnyXl.js';
|
|
14
14
|
import '../vendor/env.bmJgw1qP.js';
|
|
15
15
|
import 'std-env';
|
|
16
|
-
import '../vendor/execute.
|
|
16
|
+
import '../vendor/execute.BHj6OMh4.js';
|
|
17
17
|
import 'node:fs';
|
|
18
18
|
import 'vite-node/client';
|
|
19
19
|
import 'vite-node/utils';
|
package/dist/workers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v8 from 'v8';
|
|
2
|
-
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-
|
|
2
|
+
import { d as BirpcOptions, e as RuntimeRPC, f as ContextRPC, W as WorkerGlobalState, g as WorkerContext, R as ResolvedConfig } from './reporters-qky6mwBH.js';
|
|
3
3
|
import { Awaitable } from '@vitest/utils';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@vitest/runner';
|
package/dist/workers.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './vendor/utils.CUjzkRH7.js';
|
|
2
2
|
export { p as provideWorkerState } from './vendor/global.7bFbnyXl.js';
|
|
3
3
|
export { run as runVitestWorker } from './worker.js';
|
|
4
|
-
export { r as runVmTests } from './vendor/vm.
|
|
5
|
-
export { r as runBaseTests } from './vendor/base.
|
|
4
|
+
export { r as runVmTests } from './vendor/vm.Ow-X2mkS.js';
|
|
5
|
+
export { r as runBaseTests } from './vendor/base.D4XK-wRp.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
|
@@ -17,14 +17,14 @@ import 'node:module';
|
|
|
17
17
|
import './vendor/rpc.DRDE9Pu1.js';
|
|
18
18
|
import './vendor/index.BpSiYbpB.js';
|
|
19
19
|
import 'node:vm';
|
|
20
|
-
import './chunks/runtime-console.
|
|
20
|
+
import './chunks/runtime-console.DiVMr5d4.js';
|
|
21
21
|
import 'node:stream';
|
|
22
22
|
import 'node:path';
|
|
23
23
|
import './vendor/date.BKM1wewY.js';
|
|
24
24
|
import '@vitest/runner/utils';
|
|
25
25
|
import './vendor/env.bmJgw1qP.js';
|
|
26
26
|
import 'std-env';
|
|
27
|
-
import './vendor/execute.
|
|
27
|
+
import './vendor/execute.BHj6OMh4.js';
|
|
28
28
|
import 'vite-node/utils';
|
|
29
29
|
import '@vitest/utils/error';
|
|
30
30
|
import './path.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.5",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
120
120
|
"happy-dom": "*",
|
|
121
121
|
"jsdom": "*",
|
|
122
|
-
"@vitest/
|
|
123
|
-
"@vitest/
|
|
122
|
+
"@vitest/browser": "2.0.0-beta.5",
|
|
123
|
+
"@vitest/ui": "2.0.0-beta.5"
|
|
124
124
|
},
|
|
125
125
|
"peerDependenciesMeta": {
|
|
126
126
|
"@edge-runtime/vm": {
|
|
@@ -151,15 +151,15 @@
|
|
|
151
151
|
"picocolors": "^1.0.0",
|
|
152
152
|
"std-env": "^3.7.0",
|
|
153
153
|
"tinybench": "^2.8.0",
|
|
154
|
-
"tinypool": "^0.
|
|
154
|
+
"tinypool": "^0.9.0",
|
|
155
155
|
"vite": "^5.0.0",
|
|
156
156
|
"why-is-node-running": "^2.2.2",
|
|
157
|
-
"@vitest/expect": "2.0.0-beta.
|
|
158
|
-
"@vitest/runner": "2.0.0-beta.
|
|
159
|
-
"@vitest/
|
|
160
|
-
"@vitest/
|
|
161
|
-
"@vitest/
|
|
162
|
-
"vite-node": "2.0.0-beta.
|
|
157
|
+
"@vitest/expect": "2.0.0-beta.5",
|
|
158
|
+
"@vitest/runner": "2.0.0-beta.5",
|
|
159
|
+
"@vitest/utils": "2.0.0-beta.5",
|
|
160
|
+
"@vitest/spy": "2.0.0-beta.5",
|
|
161
|
+
"@vitest/snapshot": "2.0.0-beta.5",
|
|
162
|
+
"vite-node": "2.0.0-beta.5"
|
|
163
163
|
},
|
|
164
164
|
"devDependencies": {
|
|
165
165
|
"@ampproject/remapping": "^2.3.0",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
2
|
-
|
|
3
|
-
const filesCount = /* @__PURE__ */ new Map();
|
|
4
|
-
const cache = /* @__PURE__ */ new Map();
|
|
5
|
-
function runOnce(fn, key) {
|
|
6
|
-
const filepath = getWorkerState().filepath || "__unknown_files__";
|
|
7
|
-
if (!key) {
|
|
8
|
-
filesCount.set(filepath, (filesCount.get(filepath) || 0) + 1);
|
|
9
|
-
key = String(filesCount.get(filepath));
|
|
10
|
-
}
|
|
11
|
-
const id = `${filepath}:${key}`;
|
|
12
|
-
if (!cache.has(id))
|
|
13
|
-
cache.set(id, fn());
|
|
14
|
-
return cache.get(id);
|
|
15
|
-
}
|
|
16
|
-
function isFirstRun() {
|
|
17
|
-
let firstRun = false;
|
|
18
|
-
runOnce(() => {
|
|
19
|
-
firstRun = true;
|
|
20
|
-
}, "__vitest_first_run__");
|
|
21
|
-
return firstRun;
|
|
22
|
-
}
|
|
23
|
-
function resetRunOnceCounter() {
|
|
24
|
-
filesCount.clear();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { runOnce as a, isFirstRun as i, resetRunOnceCounter as r };
|