vitest 4.1.12 → 5.1.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 +192 -10
- package/browser/context.d.ts +7 -1
- package/browser/context.js +5 -5
- package/config.d.ts +0 -2
- package/dist/browser.d.ts +52 -21
- package/dist/browser.js +12 -13
- package/dist/chunks/{acorn.B2iPLyUM.js → acorn.C1kjbUFw.js} +30 -30
- package/dist/chunks/{base.B6Opl8PE.js → base.Cof-UHJf.js} +81 -52
- package/dist/chunks/{browser.d.BcoexmFG.d.ts → browser.d.C7tWgUvw.d.ts} +17 -14
- package/dist/chunks/{cac.DzDtg8hz.js → cac.BYbt0aJp.js} +143 -87
- package/dist/chunks/{cli-api.B0Pz1_R7.js → cli-api.COfZo8lK.js} +7160 -7189
- package/dist/chunks/config.d.B3YV4t0O.d.ts +3873 -0
- package/dist/chunks/{console.3WNpx0tS.js → console.CQZ877Hi.js} +69 -63
- package/dist/chunks/{constants.CPYnjOGj.js → constants.DLYM6cZY.js} +2 -2
- package/dist/chunks/coverage.9iqXE2gN.js +26 -0
- package/dist/chunks/{coverage.CTzCuANN.js → coverage.jGCktcGP.js} +7 -2
- package/dist/chunks/{creator.DgVhQm5q.js → creator.DHWmytIK.js} +65 -28
- package/dist/chunks/{defaults.9aQKnqFk.js → defaults.B1FCaFfh.js} +16 -9
- package/dist/chunks/display.BlTmubjj.js +194 -0
- package/dist/chunks/doctor.B-oPbwps.js +465 -0
- package/dist/chunks/{env.D4Lgay0q.js → env.BKKtU2WC.js} +2 -1
- package/dist/chunks/{environment.d.CrsxCzP1.d.ts → environment.d.BFQtFKdZ.d.ts} +9 -1
- package/dist/chunks/globals.ZKtKSkEf.js +29 -0
- package/dist/chunks/index.Bi0NXYPf.js +1708 -0
- package/dist/chunks/{index.CMESou6r.js → index.BoyTG_B7.js} +82 -81
- package/dist/chunks/index.CZzC1gGg.js +8501 -0
- package/dist/chunks/index.D0heQG4v.js +1318 -0
- package/dist/chunks/index.Di8au7q4.js +15665 -0
- package/dist/chunks/{index.Chj8NDwU.js → index.DmDMHCg8.js} +6 -12
- package/dist/chunks/{index.DXx9Dtk7.js → index.w_oBZ9N8.js} +25 -12
- package/dist/chunks/{init-forks.H5ZuobOQ.js → init-forks.BaDXQSD8.js} +7 -10
- package/dist/chunks/{init-threads.6kl1khcL.js → init-threads.ZX_Vov0z.js} +1 -1
- package/dist/chunks/{init.k9zZ9sLh.js → init.CO4AB7HZ.js} +113 -38
- package/dist/chunks/module-dependencies._2Eei3FO.js +71 -0
- package/dist/chunks/{native.DPzPHdi5.js → native.upB-V0CK.js} +50 -37
- package/dist/chunks/{nativeModuleMocker.BkNfQMkH.js → nativeModuleMocker.Dh5azSB4.js} +48 -19
- package/dist/chunks/{index.BCY_7LL2.js → nativeModuleRunner.9xPIMzi7.js} +110 -42
- package/dist/chunks/node.B9mkVmLH.js +47 -0
- package/dist/chunks/offset.Dy-5Fdfn.js +24 -0
- package/dist/chunks/pathe.M-eThtNZ.zq3TM4NT.js +492 -0
- package/dist/chunks/{reporters.d.DtoKVV2s.d.ts → plugin.d.LRFSN46m.d.ts} +2573 -1453
- package/dist/chunks/plugins.DPQHVT0p.js +37 -0
- package/dist/chunks/rawSnapshot.DqSiqIEx.js +356 -0
- package/dist/chunks/resolver.BzpmeQeT.js +48 -0
- package/dist/chunks/rpc.Uhkwr2NM.js +93 -0
- package/dist/chunks/rpc.d.3FOhdFx8.d.ts +75 -0
- package/dist/chunks/run.CjdgFZiW.js +4231 -0
- package/dist/chunks/setup-common.CqAQCXzx.js +36 -0
- package/dist/chunks/source-map.DakdQc29.js +1788 -0
- package/dist/chunks/source-map.d.BkG8YK_3.d.ts +89 -0
- package/dist/chunks/spy.DDMXghXv.js +509 -0
- package/dist/chunks/task-utils.d.D-gFPNFi.d.ts +144 -0
- package/dist/chunks/tinyrainbow.Do8I1XRG.js +88 -0
- package/dist/chunks/{utils.BS4fH3nR.js → utils.BBk_icFG.js} +50 -52
- package/dist/chunks/{utils.BX5Fg8C4.js → utils.DYj33du9.js} +1 -17
- package/dist/chunks/vm.b4MbCAJQ.js +1329 -0
- package/dist/chunks/{worker.d.ZpHpO4yb.d.ts → worker.d.CyJRpyfZ.d.ts} +34 -19
- package/dist/cli.js +5 -6
- package/dist/config.cjs +9 -6
- package/dist/config.d.ts +27 -25
- package/dist/config.js +3 -3
- package/dist/index.d.ts +471 -38
- package/dist/index.js +18 -19
- package/dist/module-evaluator.d.ts +64 -5
- package/dist/module-evaluator.js +122 -62
- package/dist/node.d.ts +355 -87
- package/dist/node.js +49 -73
- package/dist/runtime.d.ts +43 -6
- package/dist/runtime.js +7 -9
- package/dist/spy.js +1 -1
- package/dist/task-utils.js +290 -0
- package/dist/{chunks/traces.DT5aQ62U.js → traces.js} +3 -2
- package/dist/worker.d.ts +8 -10
- package/dist/worker.js +33 -43
- package/dist/workers/forks.js +30 -40
- package/dist/workers/runVmTests.js +66 -43
- package/dist/workers/threads.js +30 -40
- package/dist/workers/vmForks.js +19 -20
- package/dist/workers/vmThreads.js +19 -20
- package/globals.d.ts +19 -19
- package/index.cjs +3 -3
- package/optional-runtime-types.d.ts +1 -1
- package/optional-types.d.ts +1 -1
- package/package.json +59 -74
- package/suppress-warnings.cjs +1 -1
- package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -6
- package/dist/chunks/benchmark.CX_oY03V.js +0 -40
- package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +0 -24
- package/dist/chunks/config.d.A1h_Y6Jt.d.ts +0 -232
- package/dist/chunks/coverage.DM_a_rWm.js +0 -1087
- package/dist/chunks/coverage.d.BZtK59WP.d.ts +0 -37
- package/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -17
- package/dist/chunks/global.d.DVsSRdQ5.d.ts +0 -100
- package/dist/chunks/globals.Dj1TGiMC.js +0 -31
- package/dist/chunks/index.DC7d2Pf8.js +0 -729
- package/dist/chunks/index.DdgEv5B1.js +0 -42
- package/dist/chunks/index.UpGiHP7g.js +0 -4255
- package/dist/chunks/index.og1WyBLx.js +0 -6358
- package/dist/chunks/nativeModuleRunner.BIakptoF.js +0 -36
- package/dist/chunks/node.COQbm6gK.js +0 -14
- package/dist/chunks/plugin.d.DwFIiJ7i.d.ts +0 -38
- package/dist/chunks/rpc.MzXet3jl.js +0 -144
- package/dist/chunks/rpc.d.B_8sPU0w.d.ts +0 -30
- package/dist/chunks/setup-common.DYx3LtFI.js +0 -60
- package/dist/chunks/startVitestModuleRunner.DB-7oCpn.js +0 -740
- package/dist/chunks/suite.d.udJtyAgw.d.ts +0 -10
- package/dist/chunks/test.DNmyFkvJ.js +0 -4430
- package/dist/chunks/traces.d.D2T_R8rx.d.ts +0 -60
- package/dist/chunks/vm.CXMd5FHa.js +0 -785
- package/dist/coverage.d.ts +0 -123
- package/dist/coverage.js +0 -27
- package/dist/environments.d.ts +0 -22
- package/dist/environments.js +0 -5
- package/dist/reporters.d.ts +0 -27
- package/dist/reporters.js +0 -26
- package/dist/runners.d.ts +0 -70
- package/dist/runners.js +0 -19
- package/dist/snapshot.d.ts +0 -9
- package/dist/snapshot.js +0 -6
- package/dist/suite.d.ts +0 -5
- package/dist/suite.js +0 -8
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { toArray } from '
|
|
1
|
+
import { n as normalize, t as toArray } from './pathe.M-eThtNZ.zq3TM4NT.js';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import './
|
|
6
|
-
import { b as defaultPort, d as defaultBrowserPort } from './constants.CPYnjOGj.js';
|
|
3
|
+
import { w } from './tinyrainbow.Do8I1XRG.js';
|
|
4
|
+
import { i as isForceColor } from './env.BKKtU2WC.js';
|
|
5
|
+
import { a as defaultPort, d as defaultBrowserPort } from './constants.DLYM6cZY.js';
|
|
7
6
|
import assert from 'node:assert';
|
|
8
7
|
import { isAgent } from 'std-env';
|
|
9
8
|
|
|
@@ -621,7 +620,7 @@ class CAC extends EventEmitter {
|
|
|
621
620
|
|
|
622
621
|
const cac = (name = "") => new CAC(name);
|
|
623
622
|
|
|
624
|
-
var version = "
|
|
623
|
+
var version = "5.1.0";
|
|
625
624
|
|
|
626
625
|
const apiConfig = (port) => ({
|
|
627
626
|
port: {
|
|
@@ -677,11 +676,15 @@ const cliOptionsConfig = {
|
|
|
677
676
|
argument: "<path>",
|
|
678
677
|
normalize: true
|
|
679
678
|
},
|
|
680
|
-
ui: {
|
|
679
|
+
ui: {
|
|
680
|
+
description: "Enable UI",
|
|
681
|
+
argument: "",
|
|
682
|
+
subcommands: null
|
|
683
|
+
},
|
|
681
684
|
open: { description: "Open UI automatically (default: `!process.env.CI`)" },
|
|
682
685
|
api: {
|
|
683
686
|
argument: "[port]",
|
|
684
|
-
description: `Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to ${defaultPort}`,
|
|
687
|
+
description: `Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to ${defaultPort} or ${defaultBrowserPort} in browser mode`,
|
|
685
688
|
subcommands: apiConfig(defaultPort),
|
|
686
689
|
transform(portOrOptions) {
|
|
687
690
|
if (typeof portOrOptions === "number") return { port: portOrOptions };
|
|
@@ -699,6 +702,7 @@ const cliOptionsConfig = {
|
|
|
699
702
|
}
|
|
700
703
|
},
|
|
701
704
|
hideSkippedTests: { description: "Hide logs for skipped tests" },
|
|
705
|
+
reporter: null,
|
|
702
706
|
reporters: {
|
|
703
707
|
alias: "reporter",
|
|
704
708
|
description: `Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
|
|
@@ -751,7 +755,11 @@ const cliOptionsConfig = {
|
|
|
751
755
|
description: null,
|
|
752
756
|
argument: "",
|
|
753
757
|
subcommands: {
|
|
754
|
-
perFile: {
|
|
758
|
+
perFile: {
|
|
759
|
+
description: "Check thresholds per file. See `--coverage.thresholds.lines`, `--coverage.thresholds.functions`, `--coverage.thresholds.branches` and `--coverage.thresholds.statements` for the actual thresholds (default: `false`). Object form is available in config files only.",
|
|
760
|
+
subcommands: null,
|
|
761
|
+
argument: "<boolean>"
|
|
762
|
+
},
|
|
755
763
|
autoUpdate: {
|
|
756
764
|
description: "Update threshold values: \"lines\", \"functions\", \"branches\" and \"statements\" to configuration file when current coverage is above the configured thresholds (default: `false`)",
|
|
757
765
|
argument: "<boolean|function>",
|
|
@@ -834,15 +842,17 @@ const cliOptionsConfig = {
|
|
|
834
842
|
htmlDir: {
|
|
835
843
|
description: "Directory of HTML coverage output to be served in UI mode and HTML reporter.",
|
|
836
844
|
argument: "<path>"
|
|
837
|
-
}
|
|
845
|
+
},
|
|
846
|
+
autoAttachSubprocess: { description: "Track coverage of the `node:child_process` and `node:worker_threads` spawned during test run. Supported only by `v8` provider. (default: false)" }
|
|
838
847
|
}
|
|
839
848
|
},
|
|
840
849
|
mode: {
|
|
841
|
-
description: "Override Vite mode (default: `test`
|
|
850
|
+
description: "Override Vite mode (default: `test`)",
|
|
842
851
|
argument: "<name>"
|
|
843
852
|
},
|
|
844
853
|
isolate: { description: "Run every test file in isolation. To disable isolation, use `--no-isolate` (default: `true`)" },
|
|
845
854
|
globals: { description: "Inject apis globally" },
|
|
855
|
+
injectCjsGlobals: { description: "Inject CommonJS variables (`module`, `exports`, `require`, `__filename`, `__dirname`) into every test module. To disable, use `--no-inject-cjs-globals` (default: `true`)" },
|
|
846
856
|
dom: { description: "Mock browser API with happy-dom" },
|
|
847
857
|
browser: {
|
|
848
858
|
description: "Run tests in the browser. Equivalent to `--browser.enabled` (default: `false`)",
|
|
@@ -861,23 +871,18 @@ const cliOptionsConfig = {
|
|
|
861
871
|
argument: "<name>"
|
|
862
872
|
},
|
|
863
873
|
headless: { description: "Run the browser in headless mode (i.e. without opening the GUI (Graphical User Interface)). If you are running Vitest in CI, it will be enabled by default (default: `process.env.CI`)" },
|
|
864
|
-
api: {
|
|
865
|
-
description: "Specify options for the browser API server. Does not affect the --api option",
|
|
866
|
-
argument: "[port]",
|
|
867
|
-
subcommands: apiConfig(defaultBrowserPort)
|
|
868
|
-
},
|
|
869
|
-
isolate: { description: "Run every browser test file in isolation. To disable isolation, use `--browser.isolate=false` (default: `true`)" },
|
|
870
874
|
ui: { description: "Show Vitest UI when running tests (default: `!process.env.CI`)" },
|
|
871
875
|
detailsPanelPosition: {
|
|
872
876
|
description: "Default position for the details panel in browser mode. Either `right` (horizontal split) or `bottom` (vertical split) (default: `right`)",
|
|
873
877
|
argument: "<position>"
|
|
874
878
|
},
|
|
875
|
-
fileParallelism: { description: "Should browser test files run in parallel. Use `--browser.fileParallelism=false` to disable (default: `true`)" },
|
|
876
879
|
connectTimeout: {
|
|
877
880
|
description: "If connection to the browser takes longer, the test suite will fail (default: `60_000`)",
|
|
878
881
|
argument: "<timeout>"
|
|
879
882
|
},
|
|
883
|
+
dependencySourcemaps: { description: "Serve sourcemaps of dependencies to the browser in headless runs, used by devtools when debugging into `node_modules`. Reported test errors are source-mapped either way. Use `--browser.dependencySourcemaps=false` to speed up test runs if you don't step into dependency code (default: `true`)" },
|
|
880
884
|
trackUnhandledErrors: { description: "Control if Vitest catches uncaught exceptions so they can be reported (default: `true`)" },
|
|
885
|
+
importMapMocks: { description: "Serve module mocks through an import map instead of request interception. By default, enabled when the browser supports it" },
|
|
881
886
|
trace: {
|
|
882
887
|
description: "Enable trace view mode. Supported: \"on\", \"off\", \"on-first-retry\", \"on-all-retries\", \"retain-on-failure\".",
|
|
883
888
|
argument: "<mode>",
|
|
@@ -886,6 +891,24 @@ const cliOptionsConfig = {
|
|
|
886
891
|
return { mode: value };
|
|
887
892
|
}
|
|
888
893
|
},
|
|
894
|
+
traceView: {
|
|
895
|
+
description: "Enable Vitest trace-view collection for browser tests. `true` records every test, and `false` turns it off (default: `\"failure-only\"`)",
|
|
896
|
+
argument: "",
|
|
897
|
+
transform(value) {
|
|
898
|
+
if (typeof value === "boolean") return { mode: value ? "on" : "off" };
|
|
899
|
+
return value;
|
|
900
|
+
},
|
|
901
|
+
subcommands: {
|
|
902
|
+
enabled: { description: "Deprecated, use `--browser.traceView.mode` instead. `true` is the same as `--browser.traceView.mode=on`" },
|
|
903
|
+
mode: {
|
|
904
|
+
description: "How trace view records tests. Supported: \"on\" (every test), \"failure-only\" (only failed tests), \"off\" (default: `\"failure-only\"`)",
|
|
905
|
+
argument: "<mode>"
|
|
906
|
+
},
|
|
907
|
+
recordCanvas: { description: "Capture canvas pixels in trace-view snapshots (default: `false`)" },
|
|
908
|
+
inlineImages: { description: "Inline loaded image pixels in trace-view snapshots (default: `false`)" },
|
|
909
|
+
ariaSnapshot: { description: "Capture the accessibility tree in trace-view snapshots (default: `true`)" }
|
|
910
|
+
}
|
|
911
|
+
},
|
|
889
912
|
orchestratorScripts: null,
|
|
890
913
|
commands: null,
|
|
891
914
|
viewport: null,
|
|
@@ -896,7 +919,8 @@ const cliOptionsConfig = {
|
|
|
896
919
|
argument: "<options>",
|
|
897
920
|
subcommands: {
|
|
898
921
|
testIdAttribute: null,
|
|
899
|
-
exact: { description: "Should locators match the text exactly by default (default: `
|
|
922
|
+
exact: { description: "Should locators match the text exactly by default (default: `true`)" },
|
|
923
|
+
errorFormat: null
|
|
900
924
|
},
|
|
901
925
|
transform(val) {
|
|
902
926
|
if (typeof val !== "object" || val == null) return {};
|
|
@@ -946,6 +970,8 @@ const cliOptionsConfig = {
|
|
|
946
970
|
description: "Run tests that are affected by the changed files (default: `false`)",
|
|
947
971
|
argument: "[since]"
|
|
948
972
|
},
|
|
973
|
+
sinceLastRun: { description: "Run only the tests whose recorded dependencies were modified since the last run of the test, and the tests that failed in their last run. Enables `--changed`, `--experimental.recordDependencies` and the `mtime` provider (default: `false`)" },
|
|
974
|
+
lastFailed: { description: "Run only the tests that failed in the last run (default: `false`)" },
|
|
949
975
|
sequence: {
|
|
950
976
|
description: "Options for how tests should be sorted",
|
|
951
977
|
argument: "<options>",
|
|
@@ -964,11 +990,11 @@ const cliOptionsConfig = {
|
|
|
964
990
|
argument: "<seed>"
|
|
965
991
|
},
|
|
966
992
|
hooks: {
|
|
967
|
-
description: "Changes the order in which hooks are executed. Accepted values are: \"stack\", \"list\" and \"parallel\". Visit [`sequence.hooks`](https://vitest.dev/config/sequence#sequence-hooks) for more information (default: `\"
|
|
993
|
+
description: "Changes the order in which hooks are executed. Accepted values are: \"stack\", \"list\" and \"parallel\". Visit [`sequence.hooks`](https://vitest.dev/config/sequence#sequence-hooks) for more information (default: `\"stack\"`)",
|
|
968
994
|
argument: "<order>"
|
|
969
995
|
},
|
|
970
996
|
setupFiles: {
|
|
971
|
-
description: "Changes the order in which setup files are executed. Accepted values are: \"list\" and \"parallel\". If set to \"list\", will run setup files in the order they are defined. If set to \"parallel\", will run setup files in parallel (default: `\"
|
|
997
|
+
description: "Changes the order in which setup files are executed. Accepted values are: \"list\" and \"parallel\". If set to \"list\", will run setup files in the order they are defined. If set to \"parallel\", will run setup files in parallel (default: `\"list\"`)",
|
|
972
998
|
argument: "<order>"
|
|
973
999
|
},
|
|
974
1000
|
groupOrder: null
|
|
@@ -1027,6 +1053,10 @@ const cliOptionsConfig = {
|
|
|
1027
1053
|
}
|
|
1028
1054
|
}
|
|
1029
1055
|
},
|
|
1056
|
+
repeats: {
|
|
1057
|
+
description: "Repeat every test a specific number of times regardless of the result (default: `0`)",
|
|
1058
|
+
argument: "<number>"
|
|
1059
|
+
},
|
|
1030
1060
|
diff: {
|
|
1031
1061
|
description: "DiffOptions object or a path to a module which exports DiffOptions object",
|
|
1032
1062
|
argument: "<path>",
|
|
@@ -1059,10 +1089,10 @@ const cliOptionsConfig = {
|
|
|
1059
1089
|
description: "Placeholder for an empty first or last line (default: `\"\"`)",
|
|
1060
1090
|
argument: "<placeholder>"
|
|
1061
1091
|
},
|
|
1062
|
-
expand: { description: "Expand all common lines (default: `
|
|
1092
|
+
expand: { description: "Expand all common lines (default: `false`)" },
|
|
1063
1093
|
includeChangeCounts: { description: "Include comparison counts in diff output (default: `false`)" },
|
|
1064
1094
|
omitAnnotationLines: { description: "Omit annotation lines from the output (default: `false`)" },
|
|
1065
|
-
printBasicPrototype: { description: "Print basic prototype Object and Array (default: `
|
|
1095
|
+
printBasicPrototype: { description: "Print basic prototype Object and Array (default: `false`)" },
|
|
1066
1096
|
maxDepth: {
|
|
1067
1097
|
description: "Limit the depth to recurse when printing nested objects (default: `20`)",
|
|
1068
1098
|
argument: "<maxDepth>"
|
|
@@ -1098,6 +1128,7 @@ const cliOptionsConfig = {
|
|
|
1098
1128
|
},
|
|
1099
1129
|
allowJs: { description: "Allow JavaScript files to be typechecked. By default takes the value from tsconfig.json" },
|
|
1100
1130
|
ignoreSourceErrors: { description: "Ignore type errors from source files" },
|
|
1131
|
+
build: { description: "Use TypeScript build mode" },
|
|
1101
1132
|
tsconfig: {
|
|
1102
1133
|
description: "Path to a custom tsconfig file",
|
|
1103
1134
|
argument: "<path>",
|
|
@@ -1112,7 +1143,8 @@ const cliOptionsConfig = {
|
|
|
1112
1143
|
}
|
|
1113
1144
|
},
|
|
1114
1145
|
project: {
|
|
1115
|
-
|
|
1146
|
+
shorthand: "p",
|
|
1147
|
+
description: "The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: `--project=1 --project=2`. You can also filter projects using wildcards like `--project=packages*`, and exclude projects with `--project=!pattern`. A project runs if it matches no negated pattern and, when regular patterns are also given, matches at least one of them.",
|
|
1116
1148
|
argument: "<name>",
|
|
1117
1149
|
array: true
|
|
1118
1150
|
},
|
|
@@ -1125,20 +1157,19 @@ const cliOptionsConfig = {
|
|
|
1125
1157
|
argument: "<timeout>"
|
|
1126
1158
|
},
|
|
1127
1159
|
cache: {
|
|
1128
|
-
description: "
|
|
1160
|
+
description: "Store the results of test runs to run failed and longer test files first (default: `true`)",
|
|
1129
1161
|
argument: "",
|
|
1130
|
-
subcommands:
|
|
1131
|
-
default: true,
|
|
1132
|
-
transform(cache) {
|
|
1133
|
-
if (typeof cache !== "boolean" && cache) throw new Error("--cache.dir is deprecated");
|
|
1134
|
-
if (cache) return {};
|
|
1135
|
-
return cache;
|
|
1136
|
-
}
|
|
1162
|
+
subcommands: null
|
|
1137
1163
|
},
|
|
1138
1164
|
maxConcurrency: {
|
|
1139
1165
|
description: "Maximum number of concurrent tests and suites during test file execution (default: `5`)",
|
|
1140
1166
|
argument: "<number>"
|
|
1141
1167
|
},
|
|
1168
|
+
fsModuleCache: { description: "Cache transformed modules on the file system and reuse them between reruns (default: `true`)" },
|
|
1169
|
+
fsModuleCachePath: {
|
|
1170
|
+
description: "Directory where the `fsModuleCache` is stored (default: `node_modules/.vitest-cache`)",
|
|
1171
|
+
argument: "<path>"
|
|
1172
|
+
},
|
|
1142
1173
|
expect: {
|
|
1143
1174
|
description: "Configuration options for `expect()` matches",
|
|
1144
1175
|
argument: "",
|
|
@@ -1171,9 +1202,10 @@ const cliOptionsConfig = {
|
|
|
1171
1202
|
printConsoleTrace: { description: "Always print console stack traces" },
|
|
1172
1203
|
includeTaskLocation: { description: "Collect test and suite locations in the `location` property" },
|
|
1173
1204
|
attachmentsDir: {
|
|
1174
|
-
description: "The directory where attachments from `context.annotate` are stored in (default: `.vitest
|
|
1205
|
+
description: "The directory where attachments from `context.annotate` are stored in (default: `.vitest/attachments`)",
|
|
1175
1206
|
argument: "<dir>"
|
|
1176
1207
|
},
|
|
1208
|
+
// CLI only options
|
|
1177
1209
|
run: { description: "Disable watch mode" },
|
|
1178
1210
|
color: {
|
|
1179
1211
|
description: "Removes colors from the console output",
|
|
@@ -1189,7 +1221,7 @@ const cliOptionsConfig = {
|
|
|
1189
1221
|
description: "Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests",
|
|
1190
1222
|
argument: "[path]",
|
|
1191
1223
|
transform(value) {
|
|
1192
|
-
if (!value || typeof value === "boolean") return ".vitest
|
|
1224
|
+
if (!value || typeof value === "boolean") return ".vitest/blob";
|
|
1193
1225
|
return value;
|
|
1194
1226
|
}
|
|
1195
1227
|
},
|
|
@@ -1197,19 +1229,18 @@ const cliOptionsConfig = {
|
|
|
1197
1229
|
description: "List all available tags instead of running tests. `--list-tags=json` will output tags in JSON format, unless there are no tags.",
|
|
1198
1230
|
argument: "[type]"
|
|
1199
1231
|
},
|
|
1200
|
-
clearCache: { description: "Delete all Vitest caches, including `
|
|
1232
|
+
clearCache: { description: "Delete all Vitest caches, including the `fsModuleCache`, without running any tests. This will reduce the performance in the subsequent test run." },
|
|
1201
1233
|
tagsFilter: {
|
|
1202
1234
|
description: "Run only tests with the specified tags. You can use logical operators `&&` (and), `||` (or) and `!` (not) to create complex expressions, see [Test Tags](https://vitest.dev/guide/test-tags#syntax) for more information.",
|
|
1203
1235
|
argument: "<expression>",
|
|
1204
1236
|
array: true
|
|
1205
1237
|
},
|
|
1206
1238
|
strictTags: { description: "Should Vitest throw an error if test has a tag that is not defined in the config. (default: `true`)" },
|
|
1239
|
+
sharedViteServer: { description: "Let inline projects that don't modify the Vite config reuse the Vite server of the config that declares them. (default: `true`)" },
|
|
1207
1240
|
experimental: {
|
|
1208
1241
|
description: "Experimental features.",
|
|
1209
1242
|
argument: "<features>",
|
|
1210
1243
|
subcommands: {
|
|
1211
|
-
fsModuleCache: { description: "Enable caching of modules on the file system between reruns." },
|
|
1212
|
-
fsModuleCachePath: null,
|
|
1213
1244
|
openTelemetry: null,
|
|
1214
1245
|
importDurations: {
|
|
1215
1246
|
description: "Configure import duration collection and CLI display. Note that UI's \"Module Graph\" tab can always show import breakdown regardless of the `print` setting.",
|
|
@@ -1250,14 +1281,27 @@ const cliOptionsConfig = {
|
|
|
1250
1281
|
},
|
|
1251
1282
|
viteModuleRunner: { description: "Control whether Vitest uses Vite's module runner to run the code or fallback to the native `import`. (default: `true`)" },
|
|
1252
1283
|
nodeLoader: { description: "Controls whether Vitest will use Node.js Loader API to process in-source or mocked files. This has no effect if `viteModuleRunner` is enabled. Disabling this can increase performance. (default: `true`)" },
|
|
1284
|
+
traceTimeline: { description: "Record `expect.poll`, `vi.waitFor`, and `vi.waitUntil` steps of each test and print them as a timeline when the test fails. This has no effect in browser mode. (default: `false`)" },
|
|
1253
1285
|
vcsProvider: {
|
|
1254
1286
|
argument: "<path>",
|
|
1255
|
-
description: "
|
|
1287
|
+
description: "Provider for detecting changed files: `git`, `mtime` (requires `experimental.recordDependencies`) or a path to a custom provider. (default: `git`)",
|
|
1256
1288
|
subcommands: null
|
|
1257
1289
|
},
|
|
1258
|
-
|
|
1290
|
+
recordDependencies: { description: "Record the modules loaded by every test file in the cache and use the records with `--changed` and `--related` instead of the static module graph. A test file without a record always runs. (default: `false`)" },
|
|
1291
|
+
preParse: { description: "Parse test specifications before running them. This will apply `.only` flag and test name pattern across all files without running them. (default: `false`)" },
|
|
1292
|
+
diagnostics: {
|
|
1293
|
+
description: "Print performance hints after the run when a configuration change would make it significantly faster. Hints never suggest changing options that were set explicitly. (default: `true`)",
|
|
1294
|
+
argument: "",
|
|
1295
|
+
subcommands: {
|
|
1296
|
+
isolate: { description: "Print a hint estimating how much time `isolate: false` would save when `isolate: true` spends a significant amount of time spawning a worker per test file. (default: `true`)" },
|
|
1297
|
+
environment: { description: "Print a hint when re-creating a DOM environment for every test file dominates the run and a `vm` pool would set it up once per worker. (default: `true`)" },
|
|
1298
|
+
import: { description: "Print a hint when test files repeatedly evaluate the same module graph (typical for barrel-file imports) and `isolate: false` would evaluate it once per worker. (default: `true`)" },
|
|
1299
|
+
transform: { description: "Print a hint when transforming modules dominates the run and `fsModuleCache` would persist the results across runs. (default: `true`)" }
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1259
1302
|
}
|
|
1260
1303
|
},
|
|
1304
|
+
// disable CLI options
|
|
1261
1305
|
cliExclude: null,
|
|
1262
1306
|
server: null,
|
|
1263
1307
|
setupFiles: null,
|
|
@@ -1285,8 +1329,6 @@ const cliOptionsConfig = {
|
|
|
1285
1329
|
deps: null,
|
|
1286
1330
|
name: null,
|
|
1287
1331
|
snapshotEnvironment: null,
|
|
1288
|
-
compare: null,
|
|
1289
|
-
outputJson: null,
|
|
1290
1332
|
json: null,
|
|
1291
1333
|
provide: null,
|
|
1292
1334
|
filesOnly: null,
|
|
@@ -1294,17 +1336,9 @@ const cliOptionsConfig = {
|
|
|
1294
1336
|
staticParseConcurrency: null,
|
|
1295
1337
|
projects: null,
|
|
1296
1338
|
watchTriggerPatterns: null,
|
|
1297
|
-
tags: null
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
compare: {
|
|
1301
|
-
description: "Benchmark output file to compare against",
|
|
1302
|
-
argument: "<filename>"
|
|
1303
|
-
},
|
|
1304
|
-
outputJson: {
|
|
1305
|
-
description: "Benchmark output file",
|
|
1306
|
-
argument: "<filename>"
|
|
1307
|
-
}
|
|
1339
|
+
tags: null,
|
|
1340
|
+
benchmarkOnly: null,
|
|
1341
|
+
taskTitleValueFormatTruncate: null
|
|
1308
1342
|
};
|
|
1309
1343
|
const collectCliOptionsConfig = {
|
|
1310
1344
|
...cliOptionsConfig,
|
|
@@ -1313,7 +1347,10 @@ const collectCliOptionsConfig = {
|
|
|
1313
1347
|
argument: "[true/path]"
|
|
1314
1348
|
},
|
|
1315
1349
|
filesOnly: { description: "Print only test files with out the test cases" },
|
|
1316
|
-
staticParse: {
|
|
1350
|
+
staticParse: {
|
|
1351
|
+
description: "Parse files statically instead of running them to collect tests (default: true)",
|
|
1352
|
+
default: true
|
|
1353
|
+
},
|
|
1317
1354
|
staticParseConcurrency: {
|
|
1318
1355
|
description: "How many tests to process at the same time (default: os.availableParallelism())",
|
|
1319
1356
|
argument: "<limit>"
|
|
@@ -1321,10 +1358,12 @@ const collectCliOptionsConfig = {
|
|
|
1321
1358
|
changed: {
|
|
1322
1359
|
description: "Print only tests that are affected by the changed files (default: `false`)",
|
|
1323
1360
|
argument: "[since]"
|
|
1324
|
-
}
|
|
1361
|
+
},
|
|
1362
|
+
sinceLastRun: { description: "Print only the tests whose recorded dependencies were modified since the last run of the test, and the tests that failed in their last run (default: `false`)" },
|
|
1363
|
+
lastFailed: { description: "Print only the tests that failed in the last run (default: `false`)" }
|
|
1325
1364
|
};
|
|
1326
1365
|
|
|
1327
|
-
const a={ShellCompDirectiveError:1,ShellCompDirectiveNoSpace:2,ShellCompDirectiveNoFileComp:4,ShellCompDirectiveFilterFileExt:8,ShellCompDirectiveFilterDirs:16,ShellCompDirectiveKeepOrder:32,ShellCompDirectiveDefault:0};var o$1=class o{name;variadic;command;handler;constructor(e,t,n,r=false){this.command=e,this.name=t,this.handler=n,this.variadic=r;}},s$1=class s{value;description;command;handler;alias;isBoolean;constructor(e,t,n,r,i,a){this.command=e,this.value=t,this.description=n,this.handler=r,this.alias=i,this.isBoolean=a;}},c$1=class c{value;description;options=new Map;arguments=new Map;parent;constructor(e,t){this.value=e,this.description=t;}option(e,t,n,r){let i,a,o;typeof n==`function`?(i=n,a=r,o=false):typeof n==`string`?(i=void 0,a=n,o=true):(i=void 0,a=void 0,o=true);let c=new s$1(this,e,t,i,a,o);return this.options.set(e,c),this}argument(e,t,n=false){let r=new o$1(this,e,t,n);return this.arguments.set(e,r),this}},l$1=class l extends c$1{commands=new Map;completions=[];directive=a.ShellCompDirectiveDefault;constructor(){super(``,``);}command(e,t){let n=new c$1(e,t);return this.commands.set(e,n),n}stripOptions(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.startsWith(`-`)){n++;let t=false,i=this.findOption(this,r);if(i)t=i.isBoolean??false;else for(let[,e]of this.commands){let n=this.findOption(e,r);if(n){t=n.isBoolean??false;break}}!t&&n<e.length&&!e[n].startsWith(`-`)&&n++;}else t.push(r),n++;}return t}matchCommand(e){e=this.stripOptions(e);let t=[],n=[],r=null;for(let i=0;i<e.length;i++){let a=e[i];t.push(a);let o=this.commands.get(t.join(` `));if(o)r=o;else {n=e.slice(i,e.length);break}}return [r||this,n]}shouldCompleteFlags(e,t){if(t.startsWith(`-`))return true;if(e?.startsWith(`-`)){let t=this.findOption(this,e);if(!t){for(let[,n]of this.commands)if(t=this.findOption(n,e),t)break}return !(t&&t.isBoolean)}return false}shouldCompleteCommands(e){return !e.startsWith(`-`)}handleFlagCompletion(e,t,n,r){let i;if(n.includes(`=`)){let[e]=n.split(`=`);i=e;}else if(r?.startsWith(`-`)){let t=this.findOption(e,r);t&&!t.isBoolean&&(i=r);}if(i){let t=this.findOption(e,i);if(t?.handler){let n=[];t.handler.call(t,(e,t)=>n.push({value:e,description:t}),e.options),this.completions=n;}return}if(n.startsWith(`-`)){let t=n.startsWith(`-`)&&!n.startsWith(`--`),r=n.replace(/^-+/,``);for(let[i,a]of e.options)t&&a.alias&&`-${a.alias}`.startsWith(n)?this.completions.push({value:`-${a.alias}`,description:a.description}):!t&&i.startsWith(r)&&this.completions.push({value:`--${i}`,description:a.description});}}findOption(e,t){let n=e.options.get(t);if(n||(n=e.options.get(t.replace(/^-+/,``)),n))return n;for(let[n,r]of e.options)if(r.alias&&`-${r.alias}`===t)return r}handleCommandCompletion(e,t){let n=this.stripOptions(e);for(let[e,r]of this.commands){if(e===``)continue;let i=e.split(` `);i.slice(0,n.length).every((e,t)=>e===n[t])&&i[n.length]?.startsWith(t)&&this.completions.push({value:i[n.length],description:r.description});}}handlePositionalCompletion(e,t){let n=e.value.split(` `).length,
|
|
1366
|
+
const a={ShellCompDirectiveError:1,ShellCompDirectiveNoSpace:2,ShellCompDirectiveNoFileComp:4,ShellCompDirectiveFilterFileExt:8,ShellCompDirectiveFilterDirs:16,ShellCompDirectiveKeepOrder:32,ShellCompDirectiveDefault:0};var o$1=class o{name;variadic;command;handler;constructor(e,t,n,r=false){this.command=e,this.name=t,this.handler=n,this.variadic=r;}},s$1=class s{value;description;command;handler;alias;isBoolean;constructor(e,t,n,r,i,a){this.command=e,this.value=t,this.description=n,this.handler=r,this.alias=i,this.isBoolean=a;}},c$1=class c{value;description;options=new Map;arguments=new Map;parent;constructor(e,t){this.value=e,this.description=t;}option(e,t,n,r){let i,a,o;typeof n==`function`?(i=n,a=r,o=false):typeof n==`string`?(i=void 0,a=n,o=true):(i=void 0,a=void 0,o=true);let c=new s$1(this,e,t,i,a,o);return this.options.set(e,c),this}argument(e,t,n=false){let r=new o$1(this,e,t,n);return this.arguments.set(e,r),this}},l$1=class l extends c$1{commands=new Map;completions=[];directive=a.ShellCompDirectiveDefault;constructor(){super(``,``);}command(e,t){let n=new c$1(e,t);return this.commands.set(e,n),n}stripOptions(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.startsWith(`-`)){n++;let t=false,i=this.findOption(this,r);if(i)t=i.isBoolean??false;else for(let[,e]of this.commands){let n=this.findOption(e,r);if(n){t=n.isBoolean??false;break}}!t&&n<e.length&&!e[n].startsWith(`-`)&&n++;}else t.push(r),n++;}return t}matchCommand(e){e=this.stripOptions(e);let t=[],n=[],r=null;for(let i=0;i<e.length;i++){let a=e[i];t.push(a);let o=this.commands.get(t.join(` `));if(o)r=o;else {n=e.slice(i,e.length);break}}return [r||this,n]}shouldCompleteFlags(e,t){if(t.startsWith(`-`))return true;if(e?.startsWith(`-`)){let t=this.findOption(this,e);if(!t){for(let[,n]of this.commands)if(t=this.findOption(n,e),t)break}return !(t&&t.isBoolean)}return false}shouldCompleteCommands(e){return !e.startsWith(`-`)}handleFlagCompletion(e,t,n,r){let i;if(n.includes(`=`)){let[e]=n.split(`=`);i=e;}else if(r?.startsWith(`-`)){let t=this.findOption(e,r);t&&!t.isBoolean&&(i=r);}if(i){let t=this.findOption(e,i);if(t?.handler){let n=[];t.handler.call(t,(e,t)=>n.push({value:e,description:t}),e.options),this.completions=n;}return}if(n.startsWith(`-`)){let t=n.startsWith(`-`)&&!n.startsWith(`--`),r=n.replace(/^-+/,``);for(let[i,a]of e.options)t&&a.alias&&`-${a.alias}`.startsWith(n)?this.completions.push({value:`-${a.alias}`,description:a.description}):!t&&i.startsWith(r)&&this.completions.push({value:`--${i}`,description:a.description});}}findOption(e,t){let n=e.options.get(t);if(n||(n=e.options.get(t.replace(/^-+/,``)),n))return n;for(let[n,r]of e.options)if(r.alias&&`-${r.alias}`===t)return r}handleCommandCompletion(e,t){let n=this.stripOptions(e);for(let[e,r]of this.commands){if(e===``)continue;let i=e.split(` `);i.slice(0,n.length).every((e,t)=>e===n[t])&&i[n.length]?.startsWith(t)&&this.completions.push({value:i[n.length],description:r.description});}}handlePositionalCompletion(e,t){let n=this.stripOptions(t),r=e.value.split(` `).length,i=Math.max(0,n.length-r),a=Array.from(e.arguments.entries());if(a.length>0){let t;if(i<a.length){let[e,n]=a[i];t=n;}else {let e=a[a.length-1][1];e.variadic&&(t=e);}if(t&&t.handler&&typeof t.handler==`function`){let n=[];t.handler.call(t,(e,t)=>n.push({value:e,description:t}),e.options),this.completions.push(...n);}}}complete(e){this.directive=a.ShellCompDirectiveNoFileComp;let t=new Set;this.completions.filter(e=>t.has(e.value)?false:(t.add(e.value),true)).filter(t=>{if(e.includes(`=`)){let[,n]=e.split(`=`);return t.value.startsWith(n)}return t.value.startsWith(e)}).forEach(e=>console.log(`${e.value}\t${e.description??``}`)),console.log(`:${this.directive}`);}parse(e){this.completions=[];let t=e[e.length-1]===``;t&&e.pop();let n=e[e.length-1]||``,r=e.slice(0,-1);t&&(n!==``&&r.push(n),n=``);let[i]=this.matchCommand(r),a=r[r.length-1];this.shouldCompleteFlags(a,n)?this.handleFlagCompletion(i,r,n,a):(this.shouldCompleteCommands(n)&&this.handleCommandCompletion(r,n),i&&i.arguments.size>0&&this.handlePositionalCompletion(i,r)),this.complete(n);}setup(a,o,s){switch(assert(s===`zsh`||s===`bash`||s===`fish`||s===`powershell`,`Unsupported shell`),s){case `zsh`:{let t$1=t(a,o);console.log(t$1);break}case `bash`:{let e=n(a,o);console.log(e);break}case `fish`:{let e=r(a,o);console.log(e);break}case `powershell`:{let e=i(a,o);console.log(e);break}}}};const u=new l$1;
|
|
1328
1367
|
|
|
1329
1368
|
function t(t,n){return `#compdef ${t}
|
|
1330
1369
|
compdef _${t} ${t}
|
|
@@ -1373,7 +1412,7 @@ _${t}() {
|
|
|
1373
1412
|
|
|
1374
1413
|
# Prepare the command to obtain completions, ensuring arguments are quoted for eval
|
|
1375
1414
|
local -a args_to_quote=("\${(@)words[2,-1]}")
|
|
1376
|
-
if [ "\${lastChar}" = "" ]; then
|
|
1415
|
+
if [ "\${lastChar}" = "" ] && [ "\${args_to_quote[-1]}" != "" ]; then
|
|
1377
1416
|
# If the last parameter is complete (there is a space following it)
|
|
1378
1417
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
|
1379
1418
|
__${t}_debug "Adding extra empty parameter"
|
|
@@ -1655,17 +1694,15 @@ function __${r}_perform_completion
|
|
|
1655
1694
|
|
|
1656
1695
|
# Extract all args except the last one
|
|
1657
1696
|
set -l args (commandline -opc)
|
|
1658
|
-
# Extract the
|
|
1659
|
-
set -l lastArg (
|
|
1697
|
+
# Extract the token currently being completed (may be empty on a trailing space)
|
|
1698
|
+
set -l lastArg (commandline -ct)
|
|
1660
1699
|
|
|
1661
1700
|
__${r}_debug "args: $args"
|
|
1662
1701
|
__${r}_debug "last arg: $lastArg"
|
|
1663
1702
|
|
|
1664
|
-
#
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
__${r}_debug "Calling $requestComp"
|
|
1668
|
-
set -l results (eval $requestComp 2> /dev/null)
|
|
1703
|
+
# Pass each arg as its own token (no string join/eval, which would collapse multi-segment paths); quote "$lastArg" so an empty trailing token is still sent.
|
|
1704
|
+
__${r}_debug "Calling ${n} complete -- $args[2..-1] $lastArg"
|
|
1705
|
+
set -l results (${n} complete -- $args[2..-1] "$lastArg" 2> /dev/null)
|
|
1669
1706
|
|
|
1670
1707
|
# Some programs may output extra empty lines after the directive.
|
|
1671
1708
|
# Let's ignore them or else it will break completion.
|
|
@@ -1946,8 +1983,10 @@ complete -k -c ${t} -n '__${r}_requires_order_preservation && __${r}_prepare_com
|
|
|
1946
1983
|
# Remove the flag part
|
|
1947
1984
|
$Flag, $WordToComplete = $WordToComplete.Split("=", 2)
|
|
1948
1985
|
}
|
|
1949
|
-
|
|
1950
|
-
|
|
1986
|
+
$HasTrailingEmptyArg = $QuotedArgs -match "(^| )''$"
|
|
1987
|
+
__${t}_debug "HasTrailingEmptyArg: $HasTrailingEmptyArg"
|
|
1988
|
+
|
|
1989
|
+
if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag ) -And ( -Not $HasTrailingEmptyArg )) {
|
|
1951
1990
|
# If the last parameter is complete (there is a space following it)
|
|
1952
1991
|
# We add an extra empty parameter so we can indicate this to the go method.
|
|
1953
1992
|
__${t}_debug "Adding extra empty parameter"
|
|
@@ -2127,10 +2166,10 @@ Register-ArgumentCompleter -CommandName '${t}' -ScriptBlock $__${r}CompleterBloc
|
|
|
2127
2166
|
|
|
2128
2167
|
function e(e=`cli`){if(process.argv.indexOf(`--`)===-1){let t=`Error: You need to use -- to separate completion arguments.\nExample: ${e} complete -- <args>`;console.error(t),process.exit(1);}}
|
|
2129
2168
|
|
|
2130
|
-
const o=process.execPath,s=process.argv.slice(1),c
|
|
2169
|
+
const o=process.execPath,s=process.argv.slice(1),c=/<[^>]+>|\[[^\]]+\]/;async function l(l,u$1){for(let e of [l.globalCommand,...l.commands]){if(e.name===`complete`)continue;let t=(e.rawName.match(/\[.*?\]|<.*?>/g)||[]).map(e=>e.startsWith(`[`)),n=e.name===`@@global@@`,r=n?u$1:u$1?.subCommands?.[e.name],a=n?``:e.name,o=n?u:u.command(a,e.description||``);if(o){let n=(e.rawName.match(/<([^>]+)>|\[\.\.\.([^\]]+)\]/g)||[]).map(e=>e.startsWith(`<`)&&e.endsWith(`>`)?e.slice(1,-1):e.startsWith(`[...`)&&e.endsWith(`]`)?e.slice(4,-1):e);t.forEach((e,t)=>{let i=n[t]||`arg${t}`,a=r?.args?.[i];a?o.argument(i,a,e):o.argument(i,void 0,e);});}for(let t of [...l.globalCommand.options,...e.options]){let e=t.rawName.match(/^-([a-zA-Z]), --/)?.[1],a=t.name,s=n?u:o;if(s){let n=r?.options?.[a],i=t.required||c.test(t.rawName);n?e?s.option(a,t.description||``,n,e):s.option(a,t.description||``,n):i?e?s.option(a,t.description||``,async()=>[],e):s.option(a,t.description||``,async()=>[]):e?s.option(a,t.description||``,e):s.option(a,t.description||``);}}}return l.command(`complete [shell]`).action(async(c,u$1)=>{let d=l.name;switch(c){case `zsh`:{let t$1=t(l.name,d);console.log(t$1);break}case `bash`:{let e=n(l.name,d);console.log(e);break}case `fish`:{let e=r(l.name,d);console.log(e);break}case `powershell`:{let e=i(l.name,d);console.log(e);break}default:{e(l.name);let e$1=u$1[`--`]||[];return l.showHelpOnExit=false,l.unsetMatchedCommand(),l.parse([o,s[0],...e$1],{run:false}),u.parse(e$1)}}}),u}
|
|
2131
2170
|
|
|
2132
2171
|
async function setupTabCompletions(cli) {
|
|
2133
|
-
await
|
|
2172
|
+
await l(cli, {
|
|
2134
2173
|
subCommands: {},
|
|
2135
2174
|
options: {
|
|
2136
2175
|
environment(complete) {
|
|
@@ -2213,7 +2252,7 @@ function addCliOptions(cli, options) {
|
|
|
2213
2252
|
for (const [optionName, option] of Object.entries(options)) if (option) addCommand(cli, optionName, option);
|
|
2214
2253
|
}
|
|
2215
2254
|
function createCLI(options = {}) {
|
|
2216
|
-
if (isAgent)
|
|
2255
|
+
if (isAgent && !isForceColor()) w();
|
|
2217
2256
|
const cli = cac("vitest");
|
|
2218
2257
|
cli.version(version);
|
|
2219
2258
|
addCliOptions(cli, cliOptionsConfig);
|
|
@@ -2262,10 +2301,11 @@ function createCLI(options = {}) {
|
|
|
2262
2301
|
cli.command("related [...filters]", void 0, options).action(runRelated);
|
|
2263
2302
|
cli.command("watch [...filters]", void 0, options).action(watch);
|
|
2264
2303
|
cli.command("dev [...filters]", void 0, options).action(watch);
|
|
2265
|
-
|
|
2304
|
+
cli.command("bench [...filters]", void 0, options).action(benchmark);
|
|
2266
2305
|
cli.command("init <project>", void 0, options).action(init);
|
|
2267
|
-
|
|
2268
|
-
cli.command("[...filters]", void 0, options).action((filters, options) =>
|
|
2306
|
+
cli.command("doctor [...filters]", void 0, options).action(doctorCommand);
|
|
2307
|
+
addCliOptions(cli.command("list [...filters]", void 0, options).action((filters, options) => collect(filters, options)), collectCliOptionsConfig);
|
|
2308
|
+
cli.command("[...filters]", void 0, options).action((filters, options) => start(filters, options));
|
|
2269
2309
|
setupTabCompletions(cli);
|
|
2270
2310
|
return cli;
|
|
2271
2311
|
}
|
|
@@ -2306,20 +2346,22 @@ function parseCLI(argv, config = {}) {
|
|
|
2306
2346
|
async function runRelated(relatedFiles, argv) {
|
|
2307
2347
|
argv.related = relatedFiles;
|
|
2308
2348
|
argv.passWithNoTests ??= true;
|
|
2309
|
-
await start(
|
|
2349
|
+
await start([], argv);
|
|
2310
2350
|
}
|
|
2311
2351
|
async function watch(cliFilters, options) {
|
|
2312
2352
|
options.watch = true;
|
|
2313
|
-
await start(
|
|
2353
|
+
await start(cliFilters, options);
|
|
2314
2354
|
}
|
|
2315
2355
|
async function run(cliFilters, options) {
|
|
2316
2356
|
// "vitest run --watch" should still be watch mode
|
|
2317
2357
|
options.run = !options.watch;
|
|
2318
|
-
await start(
|
|
2358
|
+
await start(cliFilters, options);
|
|
2319
2359
|
}
|
|
2320
2360
|
async function benchmark(cliFilters, options) {
|
|
2321
|
-
|
|
2322
|
-
|
|
2361
|
+
options.benchmarkOnly = true;
|
|
2362
|
+
options.coverage ??= {};
|
|
2363
|
+
options.coverage.enabled = false;
|
|
2364
|
+
await start(cliFilters, options);
|
|
2323
2365
|
}
|
|
2324
2366
|
function normalizeCliOptions(cliFilters, argv) {
|
|
2325
2367
|
if (argv.exclude) {
|
|
@@ -2334,17 +2376,31 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
2334
2376
|
}
|
|
2335
2377
|
return argv;
|
|
2336
2378
|
}
|
|
2337
|
-
async function start(
|
|
2379
|
+
async function start(cliFilters, options) {
|
|
2338
2380
|
try {
|
|
2339
|
-
const { startVitest } = await import('./cli-api.
|
|
2340
|
-
const ctx = await startVitest(
|
|
2381
|
+
const { startVitest } = await import('./cli-api.COfZo8lK.js').then(function (n) { return n.j; });
|
|
2382
|
+
const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2341
2383
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
2342
2384
|
} catch (e) {
|
|
2343
|
-
const { errorBanner } = await import('./utils.
|
|
2385
|
+
const { errorBanner } = await import('./utils.BBk_icFG.js').then(function (n) { return n.u; });
|
|
2344
2386
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
2345
2387
|
console.error(e);
|
|
2346
2388
|
console.error("\n\n");
|
|
2347
|
-
|
|
2389
|
+
process.exitCode ??= 1;
|
|
2390
|
+
process.exit();
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
async function doctorCommand(cliFilters, options) {
|
|
2394
|
+
try {
|
|
2395
|
+
const { doctor } = await import('./doctor.B-oPbwps.js');
|
|
2396
|
+
await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2397
|
+
process.exit();
|
|
2398
|
+
} catch (e) {
|
|
2399
|
+
const { errorBanner } = await import('./utils.BBk_icFG.js').then(function (n) { return n.u; });
|
|
2400
|
+
console.error(`\n${errorBanner("Doctor Error")}`);
|
|
2401
|
+
console.error(e);
|
|
2402
|
+
console.error("\n\n");
|
|
2403
|
+
process.exitCode ??= 1;
|
|
2348
2404
|
process.exit();
|
|
2349
2405
|
}
|
|
2350
2406
|
}
|
|
@@ -2353,13 +2409,13 @@ async function init(project) {
|
|
|
2353
2409
|
console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
2354
2410
|
process.exit(1);
|
|
2355
2411
|
}
|
|
2356
|
-
const { create } = await import('./creator.
|
|
2412
|
+
const { create } = await import('./creator.DHWmytIK.js');
|
|
2357
2413
|
await create();
|
|
2358
2414
|
}
|
|
2359
|
-
async function collect(
|
|
2415
|
+
async function collect(cliFilters, options) {
|
|
2360
2416
|
try {
|
|
2361
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
2362
|
-
const ctx = await prepareVitest(
|
|
2417
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.COfZo8lK.js').then(function (n) { return n.j; });
|
|
2418
|
+
const ctx = await prepareVitest({
|
|
2363
2419
|
...normalizeCliOptions(cliFilters, options),
|
|
2364
2420
|
watch: false,
|
|
2365
2421
|
run: true
|
|
@@ -2380,11 +2436,11 @@ async function collect(mode, cliFilters, options) {
|
|
|
2380
2436
|
} else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
|
|
2381
2437
|
await ctx.close();
|
|
2382
2438
|
} catch (e) {
|
|
2383
|
-
const { errorBanner } = await import('./utils.
|
|
2439
|
+
const { errorBanner } = await import('./utils.BBk_icFG.js').then(function (n) { return n.u; });
|
|
2384
2440
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
2385
2441
|
console.error(e);
|
|
2386
2442
|
console.error("\n\n");
|
|
2387
|
-
|
|
2443
|
+
process.exitCode ??= 1;
|
|
2388
2444
|
process.exit();
|
|
2389
2445
|
}
|
|
2390
2446
|
}
|