vitest 2.0.0-beta.1 → 2.0.0-beta.11
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 -1
- package/dist/browser.d.ts +22 -2
- package/dist/browser.js +5 -3
- package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.CC2ed6Py.js} +9 -9
- package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
- package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.Ckl0vEQr.js} +76 -31
- package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.BXW_BJeO.js} +40 -32
- package/dist/cli.js +3 -3
- package/dist/config.cjs +43 -20
- package/dist/config.d.ts +2 -2
- package/dist/config.js +43 -21
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +125 -37
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +20 -30
- package/dist/index.js +9 -9
- package/dist/node.d.ts +22 -9
- package/dist/node.js +25 -15
- package/dist/path.js +4 -1
- package/dist/{reporters-MGvT5U9f.d.ts → reporters-fiIq_dT9.d.ts} +310 -148
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +8 -8
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +103 -57
- package/dist/{suite-8WAe-urM.d.ts → suite-D4aoU9rI.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/utils.d.ts +1 -5
- package/dist/utils.js +1 -6
- package/dist/vendor/{base.VFkIJ66g.js → base.C2DbLEfT.js} +4 -3
- package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
- package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.CMp8QfyL.js} +13 -14
- package/dist/vendor/{cac.DzKZaJu2.js → cac.BcJW7n2j.js} +127 -51
- package/dist/vendor/{cli-api.DTeni0Qq.js → cli-api.C8t8m4__.js} +2771 -1711
- package/dist/vendor/{constants.5SOfHUj0.js → constants.BWsVtsAj.js} +6 -22
- package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
- package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
- package/dist/vendor/{execute.CLLNVNnK.js → execute.T3gg2ZK6.js} +177 -63
- package/dist/vendor/{index.BfoZyXD1.js → index.-dbR4KUi.js} +17 -9
- package/dist/vendor/{index.CRxYS9H3.js → index.BC5zhX9y.js} +1201 -491
- package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
- package/dist/vendor/{index._7XLd8Kd.js → index.C9Thslzw.js} +2 -1
- package/dist/vendor/{index.CmILuxzC.js → index.CQJ2m700.js} +3 -3
- package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
- package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
- package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
- package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.uqZOEWuR.js} +30 -15
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
- package/dist/vendor/{utils.D5gGkwyH.js → utils.DSO2UK15.js} +41 -26
- package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
- package/dist/vendor/{vi.ClD3hi7L.js → vi.BPjl8cAZ.js} +350 -166
- package/dist/vendor/{vm.Bi3bljci.js → vm.CycSoHnJ.js} +151 -86
- package/dist/worker.js +31 -15
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +14 -13
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +6 -6
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +9 -9
- package/package.json +22 -22
- package/suppress-warnings.cjs +2 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import c from 'picocolors';
|
|
4
|
-
import { t as toArray } from './base.
|
|
5
|
-
import { d as defaultPort, a as defaultBrowserPort } from './constants.
|
|
4
|
+
import { t as toArray } from './base.CTYV4Gnz.js';
|
|
5
|
+
import { d as defaultPort, a as defaultBrowserPort } from './constants.BWsVtsAj.js';
|
|
6
6
|
|
|
7
7
|
function toArr(any) {
|
|
8
8
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
|
|
|
618
618
|
|
|
619
619
|
const cac = (name = "") => new CAC(name);
|
|
620
620
|
|
|
621
|
-
var version = "2.0.0-beta.
|
|
621
|
+
var version = "2.0.0-beta.11";
|
|
622
622
|
|
|
623
623
|
const apiConfig = (port) => ({
|
|
624
624
|
port: {
|
|
@@ -672,13 +672,15 @@ const poolForksCommands = {
|
|
|
672
672
|
execArgv: null
|
|
673
673
|
};
|
|
674
674
|
function watermarkTransform(value) {
|
|
675
|
-
if (typeof value === "string")
|
|
675
|
+
if (typeof value === "string") {
|
|
676
676
|
return value.split(",").map(Number);
|
|
677
|
+
}
|
|
677
678
|
return value;
|
|
678
679
|
}
|
|
679
680
|
function transformNestedBoolean(value) {
|
|
680
|
-
if (typeof value === "boolean")
|
|
681
|
+
if (typeof value === "boolean") {
|
|
681
682
|
return { enabled: value };
|
|
683
|
+
}
|
|
682
684
|
return value;
|
|
683
685
|
}
|
|
684
686
|
const cliOptionsConfig = {
|
|
@@ -898,14 +900,18 @@ const cliOptionsConfig = {
|
|
|
898
900
|
description: "Run tests in the browser. Equivalent to `--browser.enabled` (default: `false`)",
|
|
899
901
|
argument: "<name>",
|
|
900
902
|
transform(browser) {
|
|
901
|
-
if (typeof browser === "boolean")
|
|
903
|
+
if (typeof browser === "boolean") {
|
|
902
904
|
return { enabled: browser };
|
|
903
|
-
|
|
905
|
+
}
|
|
906
|
+
if (browser === "true" || browser === "false") {
|
|
904
907
|
return { enabled: browser === "true" };
|
|
905
|
-
|
|
908
|
+
}
|
|
909
|
+
if (browser === "yes" || browser === "no") {
|
|
906
910
|
return { enabled: browser === "yes" };
|
|
907
|
-
|
|
911
|
+
}
|
|
912
|
+
if (typeof browser === "string") {
|
|
908
913
|
return { enabled: true, name: browser };
|
|
914
|
+
}
|
|
909
915
|
return browser;
|
|
910
916
|
},
|
|
911
917
|
subcommands: {
|
|
@@ -925,7 +931,7 @@ const cliOptionsConfig = {
|
|
|
925
931
|
subcommands: apiConfig(defaultBrowserPort)
|
|
926
932
|
},
|
|
927
933
|
provider: {
|
|
928
|
-
description: 'Provider used to run browser tests. Some browsers are only available for specific providers. Can be "webdriverio", "playwright", or the path to a custom provider. Visit [`browser.provider`](https://vitest.dev/config/#browser-provider) for more information (default: `"
|
|
934
|
+
description: 'Provider used to run browser tests. Some browsers are only available for specific providers. Can be "webdriverio", "playwright", "preview", or the path to a custom provider. Visit [`browser.provider`](https://vitest.dev/config/#browser-provider) for more information (default: `"preview"`)',
|
|
929
935
|
argument: "<name>",
|
|
930
936
|
subcommands: null
|
|
931
937
|
// don't support custom objects
|
|
@@ -936,17 +942,20 @@ const cliOptionsConfig = {
|
|
|
936
942
|
subcommands: null
|
|
937
943
|
// don't support custom objects
|
|
938
944
|
},
|
|
939
|
-
slowHijackESM: {
|
|
940
|
-
description: "Let Vitest use its own module resolution on the browser to enable APIs such as vi.mock and vi.spyOn. Visit [`browser.slowHijackESM`](https://vitest.dev/config/#browser-slowhijackesm) for more information (default: `false`)"
|
|
941
|
-
},
|
|
942
945
|
isolate: {
|
|
943
946
|
description: "Run every browser test file in isolation. To disable isolation, use `--browser.isolate=false` (default: `true`)"
|
|
944
947
|
},
|
|
948
|
+
ui: {
|
|
949
|
+
description: "Show Vitest UI when running tests (default: `!process.env.CI`)"
|
|
950
|
+
},
|
|
945
951
|
fileParallelism: {
|
|
946
|
-
description: "Should
|
|
952
|
+
description: "Should browser test files run in parallel. Use `--browser.fileParallelism=false` to disable (default: `true`)"
|
|
947
953
|
},
|
|
948
|
-
|
|
949
|
-
testerScripts: null
|
|
954
|
+
orchestratorScripts: null,
|
|
955
|
+
testerScripts: null,
|
|
956
|
+
commands: null,
|
|
957
|
+
viewport: null,
|
|
958
|
+
screenshotDirectory: null
|
|
950
959
|
}
|
|
951
960
|
},
|
|
952
961
|
pool: {
|
|
@@ -1044,7 +1053,7 @@ const cliOptionsConfig = {
|
|
|
1044
1053
|
description: "Run files in a random order. Long running tests will not start earlier if you enable this option. (default: `false`)"
|
|
1045
1054
|
},
|
|
1046
1055
|
tests: {
|
|
1047
|
-
description: "Run tests in a random
|
|
1056
|
+
description: "Run tests in a random order (default: `false`)"
|
|
1048
1057
|
}
|
|
1049
1058
|
}
|
|
1050
1059
|
},
|
|
@@ -1069,10 +1078,12 @@ const cliOptionsConfig = {
|
|
|
1069
1078
|
description: "Enable Node.js inspector (default: `127.0.0.1:9229`)",
|
|
1070
1079
|
argument: "[[host:]port]",
|
|
1071
1080
|
transform(portOrEnabled) {
|
|
1072
|
-
if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes")
|
|
1081
|
+
if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes") {
|
|
1073
1082
|
return true;
|
|
1074
|
-
|
|
1083
|
+
}
|
|
1084
|
+
if (portOrEnabled === "false" || portOrEnabled === "no") {
|
|
1075
1085
|
return false;
|
|
1086
|
+
}
|
|
1076
1087
|
return portOrEnabled;
|
|
1077
1088
|
}
|
|
1078
1089
|
},
|
|
@@ -1080,10 +1091,12 @@ const cliOptionsConfig = {
|
|
|
1080
1091
|
description: "Enable Node.js inspector and break before the test starts",
|
|
1081
1092
|
argument: "[[host:]port]",
|
|
1082
1093
|
transform(portOrEnabled) {
|
|
1083
|
-
if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes")
|
|
1094
|
+
if (portOrEnabled === 0 || portOrEnabled === "true" || portOrEnabled === "yes") {
|
|
1084
1095
|
return true;
|
|
1085
|
-
|
|
1096
|
+
}
|
|
1097
|
+
if (portOrEnabled === "false" || portOrEnabled === "no") {
|
|
1086
1098
|
return false;
|
|
1099
|
+
}
|
|
1087
1100
|
return portOrEnabled;
|
|
1088
1101
|
}
|
|
1089
1102
|
},
|
|
@@ -1111,7 +1124,8 @@ const cliOptionsConfig = {
|
|
|
1111
1124
|
},
|
|
1112
1125
|
exclude: {
|
|
1113
1126
|
description: "Additional file globs to be excluded from test",
|
|
1114
|
-
argument: "<glob>"
|
|
1127
|
+
argument: "<glob>",
|
|
1128
|
+
array: true
|
|
1115
1129
|
},
|
|
1116
1130
|
expandSnapshotDiff: {
|
|
1117
1131
|
description: "Show full diff when snapshot fails"
|
|
@@ -1132,7 +1146,7 @@ const cliOptionsConfig = {
|
|
|
1132
1146
|
description: "Run only typecheck tests. This automatically enables typecheck (default: `false`)"
|
|
1133
1147
|
},
|
|
1134
1148
|
checker: {
|
|
1135
|
-
description: 'Specify the typechecker to use. Available values are: "
|
|
1149
|
+
description: 'Specify the typechecker to use. Available values are: "tsc" and "vue-tsc" and a path to an executable (default: `"tsc"`)',
|
|
1136
1150
|
argument: "<name>",
|
|
1137
1151
|
subcommands: null
|
|
1138
1152
|
},
|
|
@@ -1174,10 +1188,12 @@ const cliOptionsConfig = {
|
|
|
1174
1188
|
default: true,
|
|
1175
1189
|
// cache can only be "false" or an object
|
|
1176
1190
|
transform(cache) {
|
|
1177
|
-
if (typeof cache !== "boolean" && cache)
|
|
1191
|
+
if (typeof cache !== "boolean" && cache) {
|
|
1178
1192
|
throw new Error("--cache.dir is deprecated");
|
|
1179
|
-
|
|
1193
|
+
}
|
|
1194
|
+
if (cache) {
|
|
1180
1195
|
return {};
|
|
1196
|
+
}
|
|
1181
1197
|
return cache;
|
|
1182
1198
|
}
|
|
1183
1199
|
},
|
|
@@ -1185,15 +1201,53 @@ const cliOptionsConfig = {
|
|
|
1185
1201
|
description: "Maximum number of concurrent tests in a suite (default: `5`)",
|
|
1186
1202
|
argument: "<number>"
|
|
1187
1203
|
},
|
|
1204
|
+
expect: {
|
|
1205
|
+
description: "Configuration options for `expect()` matches",
|
|
1206
|
+
argument: "",
|
|
1207
|
+
// no displayed
|
|
1208
|
+
subcommands: {
|
|
1209
|
+
requireAssertions: {
|
|
1210
|
+
description: "Require that all tests have at least one assertion"
|
|
1211
|
+
},
|
|
1212
|
+
poll: {
|
|
1213
|
+
description: "Default options for `expect.poll()`",
|
|
1214
|
+
argument: "",
|
|
1215
|
+
subcommands: {
|
|
1216
|
+
interval: {
|
|
1217
|
+
description: "Poll interval in milliseconds for `expect.poll()` assertions (default: `50`)",
|
|
1218
|
+
argument: "<interval>"
|
|
1219
|
+
},
|
|
1220
|
+
timeout: {
|
|
1221
|
+
description: "Poll timeout in milliseconds for `expect.poll()` assertions (default: `1000`)",
|
|
1222
|
+
argument: "<timeout>"
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
transform(value) {
|
|
1226
|
+
if (typeof value !== "object") {
|
|
1227
|
+
throw new TypeError(
|
|
1228
|
+
`Unexpected value for --expect.poll: ${value}. If you need to configure timeout, use --expect.poll.timeout=<timeout>`
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
return value;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
transform(value) {
|
|
1236
|
+
if (typeof value !== "object") {
|
|
1237
|
+
throw new TypeError(
|
|
1238
|
+
`Unexpected value for --expect: ${value}. If you need to configure expect options, use --expect.{name}=<value> syntax`
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
return value;
|
|
1242
|
+
}
|
|
1243
|
+
},
|
|
1244
|
+
printConsoleTrace: {
|
|
1245
|
+
description: "Always print console stack traces"
|
|
1246
|
+
},
|
|
1188
1247
|
// CLI only options
|
|
1189
1248
|
run: {
|
|
1190
1249
|
description: "Disable watch mode"
|
|
1191
1250
|
},
|
|
1192
|
-
segfaultRetry: {
|
|
1193
|
-
description: "Retry the test suite if it crashes due to a segfault (default: `true`)",
|
|
1194
|
-
argument: "<times>",
|
|
1195
|
-
default: 0
|
|
1196
|
-
},
|
|
1197
1251
|
color: {
|
|
1198
1252
|
description: "Removes colors from the console output",
|
|
1199
1253
|
alias: "no-color"
|
|
@@ -1204,6 +1258,16 @@ const cliOptionsConfig = {
|
|
|
1204
1258
|
standalone: {
|
|
1205
1259
|
description: "Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`)"
|
|
1206
1260
|
},
|
|
1261
|
+
mergeReports: {
|
|
1262
|
+
description: "Paths to blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests",
|
|
1263
|
+
argument: "[path]",
|
|
1264
|
+
transform(value) {
|
|
1265
|
+
if (!value || typeof value === "boolean") {
|
|
1266
|
+
return ".vitest-reports";
|
|
1267
|
+
}
|
|
1268
|
+
return value;
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1207
1271
|
// disable CLI options
|
|
1208
1272
|
cliExclude: null,
|
|
1209
1273
|
server: null,
|
|
@@ -1253,8 +1317,9 @@ const benchCliOptionsConfig = {
|
|
|
1253
1317
|
function addCommand(cli, name, option) {
|
|
1254
1318
|
const commandName = option.alias || name;
|
|
1255
1319
|
let command = option.shorthand ? `-${option.shorthand}, --${commandName}` : `--${commandName}`;
|
|
1256
|
-
if ("argument" in option)
|
|
1320
|
+
if ("argument" in option) {
|
|
1257
1321
|
command += ` ${option.argument}`;
|
|
1322
|
+
}
|
|
1258
1323
|
function transform(value) {
|
|
1259
1324
|
if (!option.array && Array.isArray(value)) {
|
|
1260
1325
|
const received = value.map((s) => typeof s === "string" ? `"${s}"` : s).join(", ");
|
|
@@ -1262,19 +1327,23 @@ function addCommand(cli, name, option) {
|
|
|
1262
1327
|
`Expected a single value for option "${command}", received [${received}]`
|
|
1263
1328
|
);
|
|
1264
1329
|
}
|
|
1265
|
-
if (option.transform)
|
|
1330
|
+
if (option.transform) {
|
|
1266
1331
|
return option.transform(value);
|
|
1267
|
-
|
|
1332
|
+
}
|
|
1333
|
+
if (option.array) {
|
|
1268
1334
|
return toArray(value);
|
|
1269
|
-
|
|
1335
|
+
}
|
|
1336
|
+
if (option.normalize) {
|
|
1270
1337
|
return normalize(String(value));
|
|
1338
|
+
}
|
|
1271
1339
|
return value;
|
|
1272
1340
|
}
|
|
1273
1341
|
const hasSubcommands = "subcommands" in option && option.subcommands;
|
|
1274
1342
|
if (option.description) {
|
|
1275
1343
|
let description = option.description.replace(/\[.*\]\((.*)\)/, "$1").replace(/`/g, "");
|
|
1276
|
-
if (hasSubcommands)
|
|
1344
|
+
if (hasSubcommands) {
|
|
1277
1345
|
description += `. Use '--help --${commandName}' for more info.`;
|
|
1346
|
+
}
|
|
1278
1347
|
cli.option(command, description, {
|
|
1279
1348
|
type: transform
|
|
1280
1349
|
});
|
|
@@ -1282,15 +1351,17 @@ function addCommand(cli, name, option) {
|
|
|
1282
1351
|
if (hasSubcommands) {
|
|
1283
1352
|
for (const commandName2 in option.subcommands) {
|
|
1284
1353
|
const subcommand = option.subcommands[commandName2];
|
|
1285
|
-
if (subcommand)
|
|
1354
|
+
if (subcommand) {
|
|
1286
1355
|
addCommand(cli, `${name}.${commandName2}`, subcommand);
|
|
1356
|
+
}
|
|
1287
1357
|
}
|
|
1288
1358
|
}
|
|
1289
1359
|
}
|
|
1290
1360
|
function addCliOptions(cli, options) {
|
|
1291
1361
|
for (const [optionName, option] of Object.entries(options)) {
|
|
1292
|
-
if (option)
|
|
1362
|
+
if (option) {
|
|
1293
1363
|
addCommand(cli, optionName, option);
|
|
1364
|
+
}
|
|
1294
1365
|
}
|
|
1295
1366
|
}
|
|
1296
1367
|
function createCLI(options = {}) {
|
|
@@ -1302,11 +1373,13 @@ function createCLI(options = {}) {
|
|
|
1302
1373
|
var _a;
|
|
1303
1374
|
return (_a = current.title) == null ? void 0 : _a.startsWith("For more info, run any command");
|
|
1304
1375
|
});
|
|
1305
|
-
if (helpSection)
|
|
1376
|
+
if (helpSection) {
|
|
1306
1377
|
helpSection.body += "\n $ vitest --help --expand-help";
|
|
1378
|
+
}
|
|
1307
1379
|
const options2 = info.find((current) => current.title === "Options");
|
|
1308
|
-
if (typeof options2 !== "object")
|
|
1380
|
+
if (typeof options2 !== "object") {
|
|
1309
1381
|
return info;
|
|
1382
|
+
}
|
|
1310
1383
|
const helpIndex = process.argv.findIndex((arg) => arg === "--help");
|
|
1311
1384
|
const subcommands = process.argv.slice(helpIndex + 1);
|
|
1312
1385
|
const defaultOutput = options2.body.split("\n").filter((line) => /^\s+--\S+\./.test(line) === false).join("\n");
|
|
@@ -1314,14 +1387,16 @@ function createCLI(options = {}) {
|
|
|
1314
1387
|
options2.body = defaultOutput;
|
|
1315
1388
|
return info;
|
|
1316
1389
|
}
|
|
1317
|
-
if (subcommands.length === 1 && (subcommands[0] === "--expand-help" || subcommands[0] === "--expandHelp"))
|
|
1390
|
+
if (subcommands.length === 1 && (subcommands[0] === "--expand-help" || subcommands[0] === "--expandHelp")) {
|
|
1318
1391
|
return info;
|
|
1392
|
+
}
|
|
1319
1393
|
const subcommandMarker = "$SUB_COMMAND_MARKER$";
|
|
1320
|
-
const banner = info.find((current) => /^vitest
|
|
1394
|
+
const banner = info.find((current) => /^vitest\/\d+\.\d+\.\d+$/.test(current.body));
|
|
1321
1395
|
function addBannerWarning(warning) {
|
|
1322
1396
|
if (typeof (banner == null ? void 0 : banner.body) === "string") {
|
|
1323
|
-
if (banner == null ? void 0 : banner.body.includes(warning))
|
|
1397
|
+
if (banner == null ? void 0 : banner.body.includes(warning)) {
|
|
1324
1398
|
return;
|
|
1399
|
+
}
|
|
1325
1400
|
banner.body = `${banner.body}
|
|
1326
1401
|
WARN: ${warning}`;
|
|
1327
1402
|
}
|
|
@@ -1351,25 +1426,25 @@ function createCLI(options = {}) {
|
|
|
1351
1426
|
cli.command("bench [...filters]", void 0, options).action(benchmark),
|
|
1352
1427
|
benchCliOptionsConfig
|
|
1353
1428
|
);
|
|
1354
|
-
cli.command("typecheck [...filters]").action(() => {
|
|
1355
|
-
throw new Error(`Running typecheck via "typecheck" command is removed. Please use "--typecheck" to run your regular tests alongside typechecking, or "--typecheck.only" to run only typecheck tests.`);
|
|
1356
|
-
});
|
|
1357
1429
|
cli.command("[...filters]", void 0, options).action((filters, options2) => start("test", filters, options2));
|
|
1358
1430
|
return cli;
|
|
1359
1431
|
}
|
|
1360
1432
|
function parseCLI(argv, config = {}) {
|
|
1361
1433
|
const arrayArgs = typeof argv === "string" ? argv.split(" ") : argv;
|
|
1362
|
-
if (arrayArgs[0] !== "vitest")
|
|
1434
|
+
if (arrayArgs[0] !== "vitest") {
|
|
1363
1435
|
throw new Error(`Expected "vitest" as the first argument, received "${arrayArgs[0]}"`);
|
|
1436
|
+
}
|
|
1364
1437
|
arrayArgs[0] = "/index.js";
|
|
1365
1438
|
arrayArgs.unshift("node");
|
|
1366
1439
|
let { args, options } = createCLI(config).parse(arrayArgs, {
|
|
1367
1440
|
run: false
|
|
1368
1441
|
});
|
|
1369
|
-
if (arrayArgs[2] === "watch" || arrayArgs[2] === "dev")
|
|
1442
|
+
if (arrayArgs[2] === "watch" || arrayArgs[2] === "dev") {
|
|
1370
1443
|
options.watch = true;
|
|
1371
|
-
|
|
1444
|
+
}
|
|
1445
|
+
if (arrayArgs[2] === "run") {
|
|
1372
1446
|
options.run = true;
|
|
1447
|
+
}
|
|
1373
1448
|
if (arrayArgs[2] === "related") {
|
|
1374
1449
|
options.related = args;
|
|
1375
1450
|
options.passWithNoTests ?? (options.passWithNoTests = true);
|
|
@@ -1410,13 +1485,14 @@ async function start(mode, cliFilters, options) {
|
|
|
1410
1485
|
} catch {
|
|
1411
1486
|
}
|
|
1412
1487
|
try {
|
|
1413
|
-
const { startVitest } = await import('./cli-api.
|
|
1488
|
+
const { startVitest } = await import('./cli-api.C8t8m4__.js').then(function (n) { return n.h; });
|
|
1414
1489
|
const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
|
|
1415
|
-
if (!(ctx == null ? void 0 : ctx.shouldKeepServer()))
|
|
1490
|
+
if (!(ctx == null ? void 0 : ctx.shouldKeepServer())) {
|
|
1416
1491
|
await (ctx == null ? void 0 : ctx.exit());
|
|
1492
|
+
}
|
|
1417
1493
|
return ctx;
|
|
1418
1494
|
} catch (e) {
|
|
1419
|
-
const { divider } = await import('./utils.
|
|
1495
|
+
const { divider } = await import('./utils.DSO2UK15.js').then(function (n) { return n.u; });
|
|
1420
1496
|
console.error(`
|
|
1421
1497
|
${c.red(divider(c.bold(c.inverse(" Unhandled Error "))))}`);
|
|
1422
1498
|
console.error(e);
|