vitest 4.1.0-beta.1 → 4.1.0-beta.2
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 +36 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/acorn.B2iPLyUM.js +5958 -0
- package/dist/chunks/{base.CBRNZa3k.js → base.DiopZV8F.js} +48 -14
- package/dist/chunks/{benchmark.B3N2zMcH.js → benchmark.BoqSLF53.js} +1 -1
- package/dist/chunks/{browser.d.8hOapKZr.d.ts → browser.d.BE4kbYok.d.ts} +2 -1
- package/dist/chunks/{cac.B1v3xxoC.js → cac.C4jjt2RX.js} +797 -13
- package/dist/chunks/{cli-api.B4CqEpI6.js → cli-api.ChbI1JU9.js} +322 -124
- package/dist/chunks/{config.d.idH22YSr.d.ts → config.d.Cr1Ep39N.d.ts} +6 -1
- package/dist/chunks/{console.uGgdMhyZ.js → console.CNlG1KsP.js} +2 -2
- package/dist/chunks/{constants.D_Q9UYh-.js → constants.B63TT-Bl.js} +1 -1
- package/dist/chunks/coverage.tyqbzn4W.js +1001 -0
- package/dist/chunks/{creator.C7WwjkuR.js → creator.yyCHuw5R.js} +1 -1
- package/dist/chunks/{global.d.B15mdLcR.d.ts → global.d.JeWMqlOm.d.ts} +1 -1
- package/dist/chunks/{globals.DjuGMoMc.js → globals.C6Ecf1TO.js} +6 -6
- package/dist/chunks/{index.Dm4xqZ0s.js → index.B-iBE_Gx.js} +20 -4
- package/dist/chunks/{coverage.BMlOMIWl.js → index.BCY_7LL2.js} +5 -969
- package/dist/chunks/{index.BiOAd_ki.js → index.CAN630q3.js} +7 -7
- package/dist/chunks/{index.DyBZXrH3.js → index.CFulQRmC.js} +1 -1
- package/dist/chunks/{index.BEFi2-_3.js → index.CouFDptX.js} +2 -2
- package/dist/chunks/{init-forks.CHeQ9Moq.js → init-forks.BnCXPazU.js} +1 -1
- package/dist/chunks/{init-threads.uZiNAuPk.js → init-threads.Cyh2PqXi.js} +1 -1
- package/dist/chunks/{init.DVtKdFty.js → init.B95Mm0Iz.js} +47 -9
- package/dist/chunks/native.mV0-490A.js +148 -0
- package/dist/chunks/nativeModuleMocker.D_q5sFv6.js +206 -0
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +36 -0
- package/dist/chunks/{node.Ce0vMQM7.js → node.CrSEwhm4.js} +1 -1
- package/dist/chunks/{plugin.d.D8KU2PY_.d.ts → plugin.d.C9o5bttz.d.ts} +1 -1
- package/dist/chunks/{reporters.d.Db3MiIWX.d.ts → reporters.d.7faYdkxy.d.ts} +120 -51
- package/dist/chunks/{rpc.HLmECnw_.js → rpc.DcRWTy5G.js} +1 -1
- package/dist/chunks/{rpc.d.RH3apGEf.d.ts → rpc.d.CM7x9-sm.d.ts} +1 -0
- package/dist/chunks/{setup-common.BcqLPsn5.js → setup-common.cvFp-ao9.js} +2 -2
- package/dist/chunks/{startModuleRunner.C5CcWyXW.js → startVitestModuleRunner.BK-u7y4N.js} +163 -372
- package/dist/chunks/{test.prxIahgM.js → test.G82XYNFk.js} +9 -4
- package/dist/chunks/{utils.DvEY5TfP.js → utils.DT4VyRyl.js} +5 -1
- package/dist/chunks/{vm.CrifS09m.js → vm.BdLtzhnj.js} +13 -6
- package/dist/chunks/{worker.d.Bji1eq5g.d.ts → worker.d.CPzI2ZzJ.d.ts} +2 -2
- package/dist/cli.js +4 -3
- package/dist/config.d.ts +8 -8
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +7 -5
- package/dist/coverage.js +5 -4
- package/dist/index.d.ts +18 -23
- package/dist/index.js +5 -5
- package/dist/module-evaluator.d.ts +10 -1
- package/dist/node.d.ts +9 -9
- package/dist/node.js +18 -16
- package/dist/nodejs-worker-loader.js +41 -0
- package/dist/reporters.d.ts +5 -5
- package/dist/reporters.js +2 -2
- package/dist/runners.d.ts +2 -1
- package/dist/runners.js +4 -4
- package/dist/runtime.js +4 -5
- package/dist/snapshot.js +2 -2
- package/dist/suite.js +2 -2
- package/dist/worker.d.ts +6 -6
- package/dist/worker.js +25 -18
- package/dist/workers/forks.js +21 -14
- package/dist/workers/runVmTests.js +7 -7
- package/dist/workers/threads.js +21 -14
- package/dist/workers/vmForks.js +14 -10
- package/dist/workers/vmThreads.js +14 -10
- package/package.json +17 -14
- package/suppress-warnings.cjs +1 -0
|
@@ -5,7 +5,7 @@ import { detectPackageManager, installPackage } from './index.D3XRDfWc.js';
|
|
|
5
5
|
import { p as prompt, a as any } from './index.D4KonVSU.js';
|
|
6
6
|
import { x } from 'tinyexec';
|
|
7
7
|
import c from 'tinyrainbow';
|
|
8
|
-
import { c as configFiles } from './constants.
|
|
8
|
+
import { c as configFiles } from './constants.B63TT-Bl.js';
|
|
9
9
|
import 'node:process';
|
|
10
10
|
import 'node:module';
|
|
11
11
|
import 'node:url';
|
|
@@ -2,7 +2,7 @@ import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
|
|
|
2
2
|
import { Plugin } from '@vitest/pretty-format';
|
|
3
3
|
import { SnapshotState } from '@vitest/snapshot';
|
|
4
4
|
import { B as BenchmarkResult } from './benchmark.d.DAaHLpsq.js';
|
|
5
|
-
import { U as UserConsoleLog } from './rpc.d.
|
|
5
|
+
import { U as UserConsoleLog } from './rpc.d.CM7x9-sm.js';
|
|
6
6
|
|
|
7
7
|
interface SnapshotMatcher<T> {
|
|
8
8
|
<U extends { [P in keyof T] : any }>(snapshot: Partial<U>, hint?: string): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { g as globalApis } from './constants.
|
|
2
|
-
import { i as index } from './index.
|
|
3
|
-
import './test.
|
|
1
|
+
import { g as globalApis } from './constants.B63TT-Bl.js';
|
|
2
|
+
import { i as index } from './index.CouFDptX.js';
|
|
3
|
+
import './test.G82XYNFk.js';
|
|
4
4
|
import '@vitest/runner';
|
|
5
5
|
import '@vitest/utils/helpers';
|
|
6
6
|
import '@vitest/utils/timers';
|
|
7
|
-
import './benchmark.
|
|
7
|
+
import './benchmark.BoqSLF53.js';
|
|
8
8
|
import '@vitest/runner/utils';
|
|
9
|
-
import './utils.
|
|
9
|
+
import './utils.DT4VyRyl.js';
|
|
10
10
|
import '@vitest/expect';
|
|
11
11
|
import '@vitest/utils/error';
|
|
12
12
|
import 'pathe';
|
|
@@ -15,7 +15,7 @@ import '@vitest/spy';
|
|
|
15
15
|
import '@vitest/utils/offset';
|
|
16
16
|
import '@vitest/utils/source-map';
|
|
17
17
|
import './_commonjsHelpers.D26ty3Ew.js';
|
|
18
|
-
import './rpc.
|
|
18
|
+
import './rpc.DcRWTy5G.js';
|
|
19
19
|
import './index.Chj8NDwU.js';
|
|
20
20
|
import './evaluatedModules.Dg1zASAC.js';
|
|
21
21
|
import 'vite/module-runner';
|
|
@@ -496,13 +496,23 @@ function countTestErrors(tasks) {
|
|
|
496
496
|
}
|
|
497
497
|
function getStateString$1(tasks, name = "tests", showTotal = true) {
|
|
498
498
|
if (tasks.length === 0) return c.dim(`no ${name}`);
|
|
499
|
-
const passed = tasks.reduce((acc, i) =>
|
|
499
|
+
const passed = tasks.reduce((acc, i) => {
|
|
500
|
+
// Exclude expected failures from passed count
|
|
501
|
+
if (i.result?.state === "pass" && i.type === "test" && i.fails) return acc;
|
|
502
|
+
return i.result?.state === "pass" ? acc + 1 : acc;
|
|
503
|
+
}, 0);
|
|
500
504
|
const failed = tasks.reduce((acc, i) => i.result?.state === "fail" ? acc + 1 : acc, 0);
|
|
501
505
|
const skipped = tasks.reduce((acc, i) => i.mode === "skip" ? acc + 1 : acc, 0);
|
|
502
506
|
const todo = tasks.reduce((acc, i) => i.mode === "todo" ? acc + 1 : acc, 0);
|
|
507
|
+
const expectedFail = tasks.reduce((acc, i) => {
|
|
508
|
+
// Count tests that are marked as .fails and passed (which means they failed as expected)
|
|
509
|
+
if (i.result?.state === "pass" && i.type === "test" && i.fails) return acc + 1;
|
|
510
|
+
return acc;
|
|
511
|
+
}, 0);
|
|
503
512
|
return [
|
|
504
513
|
failed ? c.bold(c.red(`${failed} failed`)) : null,
|
|
505
514
|
passed ? c.bold(c.green(`${passed} passed`)) : null,
|
|
515
|
+
expectedFail ? c.cyan(`${expectedFail} expected fail`) : null,
|
|
506
516
|
skipped ? c.yellow(`${skipped} skipped`) : null,
|
|
507
517
|
todo ? c.gray(`${todo} todo`) : null
|
|
508
518
|
].filter(Boolean).join(c.dim(" | ")) + (showTotal ? c.gray(` (${tasks.length})`) : "");
|
|
@@ -1292,7 +1302,10 @@ class SummaryReporter {
|
|
|
1292
1302
|
stats.tests.delete(test.id);
|
|
1293
1303
|
stats.completed++;
|
|
1294
1304
|
const result = test.result();
|
|
1295
|
-
if (result?.state === "passed")
|
|
1305
|
+
if (result?.state === "passed")
|
|
1306
|
+
// Check if this is an expected failure (test.fails && passed)
|
|
1307
|
+
if (test.options.fails) this.tests.expectedFail++;
|
|
1308
|
+
else this.tests.passed++;
|
|
1296
1309
|
else if (result?.state === "failed") this.tests.failed++;
|
|
1297
1310
|
else if (!result?.state || result?.state === "skipped") this.tests.skipped++;
|
|
1298
1311
|
this.renderer.schedule();
|
|
@@ -1373,6 +1386,7 @@ function emptyCounters() {
|
|
|
1373
1386
|
failed: 0,
|
|
1374
1387
|
skipped: 0,
|
|
1375
1388
|
todo: 0,
|
|
1389
|
+
expectedFail: 0,
|
|
1376
1390
|
total: 0
|
|
1377
1391
|
};
|
|
1378
1392
|
}
|
|
@@ -1380,6 +1394,7 @@ function getStateString(entry) {
|
|
|
1380
1394
|
return [
|
|
1381
1395
|
entry.failed ? c.bold(c.red(`${entry.failed} failed`)) : null,
|
|
1382
1396
|
c.bold(c.green(`${entry.passed} passed`)),
|
|
1397
|
+
entry.expectedFail ? c.cyan(`${entry.expectedFail} expected fail`) : null,
|
|
1383
1398
|
entry.skipped ? c.yellow(`${entry.skipped} skipped`) : null,
|
|
1384
1399
|
entry.todo ? c.gray(`${entry.todo} todo`) : null
|
|
1385
1400
|
].filter(Boolean).join(c.dim(" | ")) + c.gray(` (${entry.total})`);
|
|
@@ -2599,7 +2614,7 @@ async function collectTests(ctx, filepath) {
|
|
|
2599
2614
|
});
|
|
2600
2615
|
calculateSuiteHash(file);
|
|
2601
2616
|
const hasOnly = someTasksAreOnly(file);
|
|
2602
|
-
interpretTaskModes(file, ctx.config.testNamePattern, void 0, void 0, hasOnly, false, ctx.config.allowOnly);
|
|
2617
|
+
interpretTaskModes(file, ctx.config.testNamePattern, void 0, void 0, void 0, hasOnly, false, ctx.config.allowOnly);
|
|
2603
2618
|
return {
|
|
2604
2619
|
file,
|
|
2605
2620
|
parsed: request.code,
|
|
@@ -3410,7 +3425,8 @@ class JsonReporter {
|
|
|
3410
3425
|
duration: t.result?.duration,
|
|
3411
3426
|
failureMessages: t.result?.errors?.map((e) => e.stack || e.message) || [],
|
|
3412
3427
|
location: t.location,
|
|
3413
|
-
meta: t.meta
|
|
3428
|
+
meta: t.meta,
|
|
3429
|
+
tags: t.tags || []
|
|
3414
3430
|
};
|
|
3415
3431
|
});
|
|
3416
3432
|
if (tests.some((t) => t.result?.state === "run" || t.result?.state === "queued")) this.ctx.logger.warn("WARNING: Some tests are still running when generating the JSON report.This is likely an internal bug in Vitest.Please report it to https://github.com/vitest-dev/vitest/issues");
|