vitest 5.0.0-beta.7 → 5.0.0-rc.1
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 +6 -4
- package/dist/browser.js +10 -10
- package/dist/chunks/{acorn.B2iPLyUM.js → acorn.C1kjbUFw.js} +30 -30
- package/dist/chunks/{base.B0fUxpj9.js → base.IQV3unVv.js} +46 -42
- package/dist/chunks/{browser.d.BFOby8YL.d.ts → browser.d.Dp8LNQdx.d.ts} +14 -14
- package/dist/chunks/{cac.B41kXwyU.js → cac.CM6y_f_i.js} +51 -21
- package/dist/chunks/{cli-api.bqNN5viV.js → cli-api.B4r6twmv.js} +12 -11
- package/dist/chunks/{config.d.DsC1jkby.d.ts → config.d.BpALOMjL.d.ts} +147 -118
- package/dist/chunks/{console.omGxyKMT.js → console.DWNMLVgF.js} +62 -62
- package/dist/chunks/{coverage.BVb1JqW7.js → coverage.CPiksdSj.js} +1 -1
- package/dist/chunks/{coverage.BfSEMtie.js → coverage.VANpXofm.js} +1 -1
- package/dist/chunks/{creator.BzMFaPC-.js → creator.BW8mSwbG.js} +16 -18
- package/dist/chunks/{defaults.BJUmAuaO.js → defaults.D2ip7f-X.js} +4 -2
- package/dist/chunks/{display.CYwyMF4S.js → display.pkpxlVcY.js} +3 -1
- package/dist/chunks/doctor.oxixVMjH.js +465 -0
- package/dist/chunks/{environment.d.4-rzQgpt.d.ts → environment.d.DCnG-EPE.d.ts} +1 -1
- package/dist/chunks/{globals.sd6Qutmc.js → globals.Dfl9zyCz.js} +11 -11
- package/dist/chunks/{index.DxR-nMjO.js → index.BfU4rh_M.js} +68 -30
- package/dist/chunks/{index.Chj8NDwU.js → index.CCh1Pb8k.js} +6 -12
- package/dist/chunks/{index.JaztIWgW.js → index.CePpwRnE.js} +6 -6
- package/dist/chunks/{index.CLtI1k_4.js → index.DRmbsPYf.js} +7496 -7363
- package/dist/chunks/{index.CMESou6r.js → index.DXQx-kDM.js} +77 -81
- package/dist/chunks/{index.5krd73UD.js → index.DiRpHFrd.js} +1775 -607
- package/dist/chunks/{index.DzTmMrSM.js → index.M2dsQ_UQ.js} +8 -4
- package/dist/chunks/{init-forks.CXzT841o.js → init-forks.BpFQPK_m.js} +1 -1
- package/dist/chunks/{init-threads.Ch-Bw5j3.js → init-threads.DspSJVVe.js} +1 -1
- package/dist/chunks/{init.CfiYZpFg.js → init.BU4khizz.js} +38 -10
- package/dist/chunks/{native.BUCvPRKp.js → native.offEPk9l.js} +3 -3
- package/dist/chunks/{nativeModuleMocker.Uot80PXb.js → nativeModuleMocker.0CD1hdFV.js} +19 -11
- package/dist/chunks/{nativeModuleRunner.BDnwGb8g.js → nativeModuleRunner.Bc3kXpWn.js} +64 -32
- package/dist/chunks/{node.BPMnm_Q2.js → node.CS-X6Ymg.js} +2 -1
- package/dist/chunks/{pathe.M-eThtNZ.CbK_Vbae.js → pathe.M-eThtNZ.k2RS39sQ.js} +2 -2
- package/dist/chunks/{plugin.d.BOjbmxWW.d.ts → plugin.d.xikpJNpD.d.ts} +145 -63
- package/dist/chunks/{plugins.CsoX-42X.js → plugins.Cigb0uSy.js} +1 -1
- package/dist/chunks/{resolver.CERfsKE-.js → resolver.B_5CI0Kh.js} +1 -1
- package/dist/chunks/{rpc.iNjF664v.js → rpc.DaPTofpf.js} +8 -76
- package/dist/chunks/{rpc.d.BeasqWpO.d.ts → rpc.d.DWQfGdI1.d.ts} +1 -1
- package/dist/chunks/{artifact.DC5WoEgy.js → run.DS9d28OG.js} +262 -222
- package/dist/chunks/{setup-common.vxjAyUtK.js → setup-common.D_kw2djf.js} +3 -3
- package/dist/chunks/{setup.DasACXvo.js → setup.CXTsmSEE.js} +44 -55
- package/dist/chunks/{source-map.DZdIqpIJ.js → source-map.CTObTzjj.js} +5 -4
- package/dist/chunks/{coverage.d.ByaAMV4A.d.ts → source-map.d.DRVw4m2c.d.ts} +42 -42
- package/dist/chunks/{spy.B8mHA9qu.js → spy.DPpyuUIA.js} +43 -4
- package/dist/chunks/{task-utils.d.BKHiHxSN.d.ts → task-utils.d.B0b4kWzC.d.ts} +26 -17
- package/dist/chunks/{utils.CO-iLyCr.js → utils.DtdLoSPT.js} +6 -11
- package/dist/chunks/{vm.DoQh8CN9.js → vm.QEFtWwx4.js} +464 -86
- package/dist/chunks/{worker.d.s_RdeZtI.d.ts → worker.d.D7LKSMQN.d.ts} +15 -9
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +10 -9
- package/dist/config.js +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.js +10 -10
- package/dist/module-evaluator.d.ts +19 -3
- package/dist/module-evaluator.js +26 -19
- package/dist/node.d.ts +15 -14
- package/dist/node.js +15 -15
- package/dist/runtime.d.ts +4 -4
- package/dist/runtime.js +4 -4
- package/dist/spy.js +1 -1
- package/dist/task-utils.js +8 -22
- package/dist/traces.js +2 -1
- package/dist/worker.d.ts +6 -4
- package/dist/worker.js +17 -17
- package/dist/workers/forks.js +18 -18
- package/dist/workers/runVmTests.js +44 -32
- package/dist/workers/threads.js +18 -18
- package/dist/workers/vmForks.js +15 -13
- package/dist/workers/vmThreads.js +15 -13
- package/package.json +33 -35
package/LICENSE.md
CHANGED
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { F as FileSpecification, c as SerializedDiffOptions } from './chunks/config.d.BpALOMjL.js';
|
|
2
|
+
import { SerializedCoverageConfig, RunnerTestFile as File, SerializedConfig, DiffOptions, TestError } from './index.js';
|
|
3
|
+
import { VitestRunner } from './runtime.js';
|
|
4
|
+
export { P as ParsedStack, _ as SpyModule, d as StringifyOptions, f as format, i as inspect, s as stringify } from './chunks/config.d.BpALOMjL.js';
|
|
5
|
+
import { R as RuntimeCoverageModuleLoader } from './chunks/source-map.d.DRVw4m2c.js';
|
|
6
|
+
export { D as DecodedMap, g as getOriginalPosition } from './chunks/source-map.d.DRVw4m2c.js';
|
|
5
7
|
import 'vitest/optional-runtime-types.js';
|
|
6
8
|
import 'tinybench';
|
|
7
9
|
|
package/dist/browser.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.
|
|
2
|
-
export { p as collectTests, a as processError, s as startTests } from './chunks/
|
|
3
|
-
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.
|
|
4
|
-
export { s as SpyModule } from './chunks/spy.
|
|
5
|
-
export { f as format, i as inspect, s as stringify } from './chunks/display.
|
|
6
|
-
export { g as getType } from './chunks/pathe.M-eThtNZ.
|
|
7
|
-
export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.
|
|
8
|
-
import './chunks/coverage.
|
|
9
|
-
import './chunks/index.
|
|
1
|
+
export { s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.VANpXofm.js';
|
|
2
|
+
export { p as collectTests, a as processError, s as startTests } from './chunks/run.DS9d28OG.js';
|
|
3
|
+
export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv, b as setupEnv } from './chunks/setup-common.D_kw2djf.js';
|
|
4
|
+
export { s as SpyModule } from './chunks/spy.DPpyuUIA.js';
|
|
5
|
+
export { f as format, i as inspect, s as stringify } from './chunks/display.pkpxlVcY.js';
|
|
6
|
+
export { g as getType } from './chunks/pathe.M-eThtNZ.k2RS39sQ.js';
|
|
7
|
+
export { D as DecodedMap, g as getOriginalPosition, a as getSafeTimers, s as setSafeTimers } from './chunks/source-map.CTObTzjj.js';
|
|
8
|
+
import './chunks/coverage.CPiksdSj.js';
|
|
9
|
+
import './chunks/index.M2dsQ_UQ.js';
|
|
10
10
|
import './chunks/tinyrainbow.Ht9iggcq.js';
|
|
11
11
|
import './task-utils.js';
|
|
12
|
-
import './chunks/plugins.
|
|
12
|
+
import './chunks/plugins.Cigb0uSy.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @internal
|
|
@@ -817,10 +817,10 @@ var pp$8 = Parser.prototype;
|
|
|
817
817
|
// to its body instead of creating a new node.
|
|
818
818
|
|
|
819
819
|
pp$8.parseTopLevel = function(node) {
|
|
820
|
-
var exports
|
|
820
|
+
var exports = Object.create(null);
|
|
821
821
|
if (!node.body) { node.body = []; }
|
|
822
822
|
while (this.type !== types$1.eof) {
|
|
823
|
-
var stmt = this.parseStatement(null, true, exports
|
|
823
|
+
var stmt = this.parseStatement(null, true, exports);
|
|
824
824
|
node.body.push(stmt);
|
|
825
825
|
}
|
|
826
826
|
if (this.inModule)
|
|
@@ -884,7 +884,7 @@ pp$8.isAsyncFunction = function() {
|
|
|
884
884
|
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
|
|
885
885
|
// does not help.
|
|
886
886
|
|
|
887
|
-
pp$8.parseStatement = function(context, topLevel, exports
|
|
887
|
+
pp$8.parseStatement = function(context, topLevel, exports) {
|
|
888
888
|
var starttype = this.type, node = this.startNode(), kind;
|
|
889
889
|
|
|
890
890
|
if (this.isLet(context)) {
|
|
@@ -939,7 +939,7 @@ pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
|
939
939
|
if (!this.inModule)
|
|
940
940
|
{ this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
|
|
941
941
|
}
|
|
942
|
-
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports
|
|
942
|
+
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
|
|
943
943
|
|
|
944
944
|
// If the statement does not start with a statement keyword or a
|
|
945
945
|
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
@@ -1654,11 +1654,11 @@ function checkKeyName(node, name) {
|
|
|
1654
1654
|
|
|
1655
1655
|
// Parses module export declaration.
|
|
1656
1656
|
|
|
1657
|
-
pp$8.parseExportAllDeclaration = function(node, exports
|
|
1657
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
1658
1658
|
if (this.options.ecmaVersion >= 11) {
|
|
1659
1659
|
if (this.eatContextual("as")) {
|
|
1660
1660
|
node.exported = this.parseModuleExportName();
|
|
1661
|
-
this.checkExport(exports
|
|
1661
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
1662
1662
|
} else {
|
|
1663
1663
|
node.exported = null;
|
|
1664
1664
|
}
|
|
@@ -1670,14 +1670,14 @@ pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
|
1670
1670
|
return this.finishNode(node, "ExportAllDeclaration")
|
|
1671
1671
|
};
|
|
1672
1672
|
|
|
1673
|
-
pp$8.parseExport = function(node, exports
|
|
1673
|
+
pp$8.parseExport = function(node, exports) {
|
|
1674
1674
|
this.next();
|
|
1675
1675
|
// export * from '...'
|
|
1676
1676
|
if (this.eat(types$1.star)) {
|
|
1677
|
-
return this.parseExportAllDeclaration(node, exports
|
|
1677
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
1678
1678
|
}
|
|
1679
1679
|
if (this.eat(types$1._default)) { // export default ...
|
|
1680
|
-
this.checkExport(exports
|
|
1680
|
+
this.checkExport(exports, "default", this.lastTokStart);
|
|
1681
1681
|
node.declaration = this.parseExportDefaultDeclaration();
|
|
1682
1682
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
1683
1683
|
}
|
|
@@ -1685,14 +1685,14 @@ pp$8.parseExport = function(node, exports$1) {
|
|
|
1685
1685
|
if (this.shouldParseExportStatement()) {
|
|
1686
1686
|
node.declaration = this.parseExportDeclaration(node);
|
|
1687
1687
|
if (node.declaration.type === "VariableDeclaration")
|
|
1688
|
-
{ this.checkVariableExport(exports
|
|
1688
|
+
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
1689
1689
|
else
|
|
1690
|
-
{ this.checkExport(exports
|
|
1690
|
+
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
|
|
1691
1691
|
node.specifiers = [];
|
|
1692
1692
|
node.source = null;
|
|
1693
1693
|
} else { // export { x, y as z } [from '...']
|
|
1694
1694
|
node.declaration = null;
|
|
1695
|
-
node.specifiers = this.parseExportSpecifiers(exports
|
|
1695
|
+
node.specifiers = this.parseExportSpecifiers(exports);
|
|
1696
1696
|
if (this.eatContextual("from")) {
|
|
1697
1697
|
if (this.type !== types$1.string) { this.unexpected(); }
|
|
1698
1698
|
node.source = this.parseExprAtom();
|
|
@@ -1738,47 +1738,47 @@ pp$8.parseExportDefaultDeclaration = function() {
|
|
|
1738
1738
|
}
|
|
1739
1739
|
};
|
|
1740
1740
|
|
|
1741
|
-
pp$8.checkExport = function(exports
|
|
1742
|
-
if (!exports
|
|
1741
|
+
pp$8.checkExport = function(exports, name, pos) {
|
|
1742
|
+
if (!exports) { return }
|
|
1743
1743
|
if (typeof name !== "string")
|
|
1744
1744
|
{ name = name.type === "Identifier" ? name.name : name.value; }
|
|
1745
|
-
if (hasOwn(exports
|
|
1745
|
+
if (hasOwn(exports, name))
|
|
1746
1746
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
1747
|
-
exports
|
|
1747
|
+
exports[name] = true;
|
|
1748
1748
|
};
|
|
1749
1749
|
|
|
1750
|
-
pp$8.checkPatternExport = function(exports
|
|
1750
|
+
pp$8.checkPatternExport = function(exports, pat) {
|
|
1751
1751
|
var type = pat.type;
|
|
1752
1752
|
if (type === "Identifier")
|
|
1753
|
-
{ this.checkExport(exports
|
|
1753
|
+
{ this.checkExport(exports, pat, pat.start); }
|
|
1754
1754
|
else if (type === "ObjectPattern")
|
|
1755
1755
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
|
1756
1756
|
{
|
|
1757
1757
|
var prop = list[i];
|
|
1758
1758
|
|
|
1759
|
-
this.checkPatternExport(exports
|
|
1759
|
+
this.checkPatternExport(exports, prop);
|
|
1760
1760
|
} }
|
|
1761
1761
|
else if (type === "ArrayPattern")
|
|
1762
1762
|
{ for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
1763
1763
|
var elt = list$1[i$1];
|
|
1764
1764
|
|
|
1765
|
-
if (elt) { this.checkPatternExport(exports
|
|
1765
|
+
if (elt) { this.checkPatternExport(exports, elt); }
|
|
1766
1766
|
} }
|
|
1767
1767
|
else if (type === "Property")
|
|
1768
|
-
{ this.checkPatternExport(exports
|
|
1768
|
+
{ this.checkPatternExport(exports, pat.value); }
|
|
1769
1769
|
else if (type === "AssignmentPattern")
|
|
1770
|
-
{ this.checkPatternExport(exports
|
|
1770
|
+
{ this.checkPatternExport(exports, pat.left); }
|
|
1771
1771
|
else if (type === "RestElement")
|
|
1772
|
-
{ this.checkPatternExport(exports
|
|
1772
|
+
{ this.checkPatternExport(exports, pat.argument); }
|
|
1773
1773
|
};
|
|
1774
1774
|
|
|
1775
|
-
pp$8.checkVariableExport = function(exports
|
|
1776
|
-
if (!exports
|
|
1775
|
+
pp$8.checkVariableExport = function(exports, decls) {
|
|
1776
|
+
if (!exports) { return }
|
|
1777
1777
|
for (var i = 0, list = decls; i < list.length; i += 1)
|
|
1778
1778
|
{
|
|
1779
1779
|
var decl = list[i];
|
|
1780
1780
|
|
|
1781
|
-
this.checkPatternExport(exports
|
|
1781
|
+
this.checkPatternExport(exports, decl.id);
|
|
1782
1782
|
}
|
|
1783
1783
|
};
|
|
1784
1784
|
|
|
@@ -1793,13 +1793,13 @@ pp$8.shouldParseExportStatement = function() {
|
|
|
1793
1793
|
|
|
1794
1794
|
// Parses a comma-separated list of module exports.
|
|
1795
1795
|
|
|
1796
|
-
pp$8.parseExportSpecifier = function(exports
|
|
1796
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
1797
1797
|
var node = this.startNode();
|
|
1798
1798
|
node.local = this.parseModuleExportName();
|
|
1799
1799
|
|
|
1800
1800
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
1801
1801
|
this.checkExport(
|
|
1802
|
-
exports
|
|
1802
|
+
exports,
|
|
1803
1803
|
node.exported,
|
|
1804
1804
|
node.exported.start
|
|
1805
1805
|
);
|
|
@@ -1807,7 +1807,7 @@ pp$8.parseExportSpecifier = function(exports$1) {
|
|
|
1807
1807
|
return this.finishNode(node, "ExportSpecifier")
|
|
1808
1808
|
};
|
|
1809
1809
|
|
|
1810
|
-
pp$8.parseExportSpecifiers = function(exports
|
|
1810
|
+
pp$8.parseExportSpecifiers = function(exports) {
|
|
1811
1811
|
var nodes = [], first = true;
|
|
1812
1812
|
// export { x, y as z } [from '...']
|
|
1813
1813
|
this.expect(types$1.braceL);
|
|
@@ -1817,7 +1817,7 @@ pp$8.parseExportSpecifiers = function(exports$1) {
|
|
|
1817
1817
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
1818
1818
|
} else { first = false; }
|
|
1819
1819
|
|
|
1820
|
-
nodes.push(this.parseExportSpecifier(exports
|
|
1820
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
1821
1821
|
}
|
|
1822
1822
|
return nodes
|
|
1823
1823
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { runInThisContext } from 'node:vm';
|
|
2
|
-
import { s as spyModule } from './spy.
|
|
3
|
-
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.
|
|
4
|
-
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.
|
|
2
|
+
import { s as spyModule } from './spy.DPpyuUIA.js';
|
|
3
|
+
import { r as resolveTestRunner, a as resolveSnapshotEnvironment, d as detectAsyncLeaks, s as setupChaiConfig } from './index.CePpwRnE.js';
|
|
4
|
+
import { l as loadEnvironment, e as emitModuleRunner, a as listenForErrors } from './init.BU4khizz.js';
|
|
5
5
|
import { Traces } from '../traces.js';
|
|
6
|
-
import { V as VitestEvaluatedModules } from './rpc.
|
|
7
|
-
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.
|
|
6
|
+
import { V as VitestEvaluatedModules } from './rpc.DaPTofpf.js';
|
|
7
|
+
import { s as startVitestModuleRunner, c as createNodeImportMeta } from './index.BfU4rh_M.js';
|
|
8
8
|
import { performance as performance$1 } from 'node:perf_hooks';
|
|
9
|
-
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.
|
|
10
|
-
import { i as index, g as globalExpect, v as vi } from './index.
|
|
9
|
+
import { s as startCoverageInsideWorker, a as stopCoverageInsideWorker } from './coverage.VANpXofm.js';
|
|
10
|
+
import { i as index, g as globalExpect, v as vi } from './index.DRmbsPYf.js';
|
|
11
11
|
import { c as closeInspector } from './inspector.CvyFGlXm.js';
|
|
12
|
-
import { s as startTests, p as publicCollect } from './
|
|
12
|
+
import { s as startTests, p as publicCollect } from './run.DS9d28OG.js';
|
|
13
13
|
import { createRequire } from 'node:module';
|
|
14
14
|
import timers from 'node:timers';
|
|
15
15
|
import timersPromises from 'node:timers/promises';
|
|
16
16
|
import util from 'node:util';
|
|
17
|
-
import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.
|
|
18
|
-
import { s as setupCommonEnv, b as setupEnv } from './setup-common.
|
|
17
|
+
import { K as KNOWN_ASSET_TYPES } from './pathe.M-eThtNZ.k2RS39sQ.js';
|
|
18
|
+
import { s as setupCommonEnv, b as setupEnv } from './setup-common.D_kw2djf.js';
|
|
19
19
|
import { g as getWorkerState, r as resetModules, p as provideWorkerState, a as getSafeWorkerState } from './utils.DYj33du9.js';
|
|
20
20
|
|
|
21
21
|
// this should only be used in Node
|
|
@@ -57,7 +57,7 @@ function resolveAsset(mod, url) {
|
|
|
57
57
|
mod.exports = url;
|
|
58
58
|
}
|
|
59
59
|
async function setupConsoleLogSpy() {
|
|
60
|
-
const { createCustomConsole } = await import('./console.
|
|
60
|
+
const { createCustomConsole } = await import('./console.DWNMLVgF.js');
|
|
61
61
|
globalThis.console = createCustomConsole();
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -72,30 +72,34 @@ async function run(method, files, config, moduleRunner, environment, traces) {
|
|
|
72
72
|
if (!workerState.config.snapshotOptions.snapshotEnvironment) workerState.config.snapshotOptions.snapshotEnvironment = await resolveSnapshotEnvironment(config, moduleRunner);
|
|
73
73
|
})
|
|
74
74
|
]);
|
|
75
|
-
workerState.onCancel((reason) => {
|
|
75
|
+
const offCancel = workerState.onCancel((reason) => {
|
|
76
76
|
closeInspector(config);
|
|
77
77
|
testRunner.cancel?.(reason);
|
|
78
78
|
});
|
|
79
79
|
workerState.durations.prepare = performance$1.now() - workerState.durations.prepare;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
try {
|
|
81
|
+
await traces.$(`vitest.test.runner.${method}`, async () => {
|
|
82
|
+
for (const file of files) {
|
|
83
|
+
if (config.isolate) {
|
|
84
|
+
moduleRunner.mocker?.reset();
|
|
85
|
+
resetModules(workerState.evaluatedModules, true);
|
|
86
|
+
}
|
|
87
|
+
workerState.filepath = file.filepath;
|
|
88
|
+
if (method === "run") {
|
|
89
|
+
const collectAsyncLeaks = config.detectAsyncLeaks ? detectAsyncLeaks(file.filepath, workerState.ctx.projectName) : void 0;
|
|
90
|
+
await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => startTests([file], testRunner));
|
|
91
|
+
const leaks = await collectAsyncLeaks?.();
|
|
92
|
+
if (leaks?.length) workerState.rpc.onAsyncLeaks(leaks);
|
|
93
|
+
} else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => publicCollect([file], testRunner));
|
|
94
|
+
// reset after tests, because user might call `vi.setConfig` in setupFile
|
|
95
|
+
vi.resetConfig();
|
|
96
|
+
// mocks should not affect different files
|
|
97
|
+
vi.restoreAllMocks();
|
|
85
98
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const leaks = await collectAsyncLeaks?.();
|
|
91
|
-
if (leaks?.length) workerState.rpc.onAsyncLeaks(leaks);
|
|
92
|
-
} else await traces.$(`vitest.test.runner.${method}.module`, { attributes: { "code.file.path": file.filepath } }, () => publicCollect([file], testRunner));
|
|
93
|
-
// reset after tests, because user might call `vi.setConfig` in setupFile
|
|
94
|
-
vi.resetConfig();
|
|
95
|
-
// mocks should not affect different files
|
|
96
|
-
vi.restoreAllMocks();
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
+
});
|
|
100
|
+
} finally {
|
|
101
|
+
offCancel();
|
|
102
|
+
}
|
|
99
103
|
await traces.$("vitest.runtime.coverage.stop", () => stopCoverageInsideWorker(config.coverage, moduleRunner, { isolate: config.isolate }));
|
|
100
104
|
}
|
|
101
105
|
|
|
@@ -114,7 +118,7 @@ async function startModuleRunner(options) {
|
|
|
114
118
|
let mocker;
|
|
115
119
|
if (options.state.config.experimental.nodeLoader !== false) {
|
|
116
120
|
// this additionally imports acorn/magic-string
|
|
117
|
-
const { NativeModuleMocker } = await import('./nativeModuleMocker.
|
|
121
|
+
const { NativeModuleMocker } = await import('./nativeModuleMocker.0CD1hdFV.js');
|
|
118
122
|
mocker = new NativeModuleMocker({
|
|
119
123
|
async resolveId(id, importer) {
|
|
120
124
|
// TODO: use import.meta.resolve instead
|
|
@@ -131,7 +135,7 @@ async function startModuleRunner(options) {
|
|
|
131
135
|
}
|
|
132
136
|
// imported lazily (pulls in `local-pkg`) so it stays out of the default
|
|
133
137
|
// worker startup graph; only the `viteModuleRunner: false` path needs it
|
|
134
|
-
const { NativeModuleRunner } = await import('./nativeModuleRunner.
|
|
138
|
+
const { NativeModuleRunner } = await import('./nativeModuleRunner.Bc3kXpWn.js').then(function (n) { return n.n; });
|
|
135
139
|
_moduleRunner = new NativeModuleRunner(root, mocker);
|
|
136
140
|
return _moduleRunner;
|
|
137
141
|
}
|
|
@@ -143,21 +147,12 @@ let _environmentTime;
|
|
|
143
147
|
/** @experimental */
|
|
144
148
|
async function setupBaseEnvironment(context) {
|
|
145
149
|
if (context.config.experimental.viteModuleRunner === false) {
|
|
146
|
-
const { setupNodeLoaderHooks } = await import('./native.
|
|
150
|
+
const { setupNodeLoaderHooks } = await import('./native.offEPk9l.js');
|
|
147
151
|
await setupNodeLoaderHooks(context);
|
|
148
152
|
}
|
|
149
153
|
const startTime = performance.now();
|
|
150
154
|
const { environment: { name: environmentName, options: environmentOptions }, rpc, config } = context;
|
|
151
155
|
setupEnv(config.env, context.metaEnv);
|
|
152
|
-
// we could load @vite/env, but it would take ~8ms, while this takes ~0,02ms
|
|
153
|
-
if (context.config.serializedDefines) try {
|
|
154
|
-
runInThisContext(`(() =>{\n${context.config.serializedDefines}})()`, {
|
|
155
|
-
lineOffset: 1,
|
|
156
|
-
filename: "virtual:load-defines.js"
|
|
157
|
-
});
|
|
158
|
-
} catch (error) {
|
|
159
|
-
throw new Error(`Failed to load custom "defines": ${error.message}`);
|
|
160
|
-
}
|
|
161
156
|
const otel = context.traces;
|
|
162
157
|
const { environment, loader } = await loadEnvironment(environmentName, config.root, rpc, otel, context.config.experimental.viteModuleRunner);
|
|
163
158
|
_currentEnvironment = environment;
|
|
@@ -181,6 +176,15 @@ async function runBaseTests(method, state, traces) {
|
|
|
181
176
|
state.evaluatedModules = evaluatedModules;
|
|
182
177
|
state.moduleExecutionInfo = moduleExecutionInfo;
|
|
183
178
|
provideWorkerState(globalThis, state);
|
|
179
|
+
// we could load @vite/env, but it would take ~8ms, while this takes ~0,02ms
|
|
180
|
+
if (state.config.serializedDefines) try {
|
|
181
|
+
runInThisContext(`(() =>{\n${state.config.serializedDefines}})()`, {
|
|
182
|
+
lineOffset: 1,
|
|
183
|
+
filename: "virtual:load-defines.js"
|
|
184
|
+
});
|
|
185
|
+
} catch (error) {
|
|
186
|
+
throw new Error(`Failed to load custom "defines": ${error.message}`);
|
|
187
|
+
}
|
|
184
188
|
if (ctx.invalidates) ctx.invalidates.forEach((filepath) => {
|
|
185
189
|
(state.evaluatedModules.fileToModulesMap.get(filepath) || []).forEach((module) => {
|
|
186
190
|
state.evaluatedModules.invalidateModule(module);
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { O as OTELCarrier } from './rpc.d.
|
|
3
|
-
import { T as TestExecutionMethod } from './worker.d.
|
|
4
|
-
|
|
5
|
-
type SerializedTestSpecification = [project: {
|
|
6
|
-
name: string | undefined;
|
|
7
|
-
root: string;
|
|
8
|
-
}, file: string, options: {
|
|
9
|
-
pool: string;
|
|
10
|
-
testLines?: number[] | undefined;
|
|
11
|
-
testIds?: string[] | undefined;
|
|
12
|
-
testNamePattern?: RegExp | undefined;
|
|
13
|
-
testTagsFilter?: string[] | undefined;
|
|
14
|
-
}];
|
|
1
|
+
import { F as FileSpecification } from './config.d.BpALOMjL.js';
|
|
2
|
+
import { O as OTELCarrier } from './rpc.d.DWQfGdI1.js';
|
|
3
|
+
import { T as TestExecutionMethod } from './worker.d.D7LKSMQN.js';
|
|
15
4
|
|
|
16
5
|
interface ModuleDefinitionLocation {
|
|
17
6
|
line: number;
|
|
@@ -52,6 +41,17 @@ interface SourceModuleDiagnostic {
|
|
|
52
41
|
untrackedModules: UntrackedModuleDefinitionDiagnostic[];
|
|
53
42
|
}
|
|
54
43
|
|
|
44
|
+
type SerializedTestSpecification = [project: {
|
|
45
|
+
name: string | undefined;
|
|
46
|
+
root: string;
|
|
47
|
+
}, file: string, options: {
|
|
48
|
+
pool: string;
|
|
49
|
+
testLines?: number[] | undefined;
|
|
50
|
+
testIds?: string[] | undefined;
|
|
51
|
+
testNamePattern?: RegExp | undefined;
|
|
52
|
+
testTagsFilter?: string[] | undefined;
|
|
53
|
+
}];
|
|
54
|
+
|
|
55
55
|
interface BrowserTesterOptions {
|
|
56
56
|
method: TestExecutionMethod;
|
|
57
57
|
files: FileSpecification[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as normalize, t as toArray } from './pathe.M-eThtNZ.
|
|
1
|
+
import { n as normalize, t as toArray } from './pathe.M-eThtNZ.k2RS39sQ.js';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { m } from './tinyrainbow.Ht9iggcq.js';
|
|
4
4
|
import { a as isForceColor } from './env.DzFJjrmK.js';
|
|
@@ -620,7 +620,7 @@ class CAC extends EventEmitter {
|
|
|
620
620
|
|
|
621
621
|
const cac = (name = "") => new CAC(name);
|
|
622
622
|
|
|
623
|
-
var version = "5.0.0-
|
|
623
|
+
var version = "5.0.0-rc.1";
|
|
624
624
|
|
|
625
625
|
const apiConfig = (port) => ({
|
|
626
626
|
port: {
|
|
@@ -1128,6 +1128,7 @@ const cliOptionsConfig = {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
},
|
|
1130
1130
|
project: {
|
|
1131
|
+
shorthand: "p",
|
|
1131
1132
|
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`.",
|
|
1132
1133
|
argument: "<name>",
|
|
1133
1134
|
array: true
|
|
@@ -1145,6 +1146,7 @@ const cliOptionsConfig = {
|
|
|
1145
1146
|
argument: "",
|
|
1146
1147
|
subcommands: { dir: null },
|
|
1147
1148
|
default: true,
|
|
1149
|
+
// cache can only be "false" or an object
|
|
1148
1150
|
transform(cache) {
|
|
1149
1151
|
if (typeof cache !== "boolean" && cache) throw new Error("--cache.dir is deprecated");
|
|
1150
1152
|
if (cache) return {};
|
|
@@ -1195,6 +1197,7 @@ const cliOptionsConfig = {
|
|
|
1195
1197
|
description: "The directory where attachments from `context.annotate` are stored in (default: `.vitest/attachments`)",
|
|
1196
1198
|
argument: "<dir>"
|
|
1197
1199
|
},
|
|
1200
|
+
// CLI only options
|
|
1198
1201
|
run: { description: "Disable watch mode" },
|
|
1199
1202
|
color: {
|
|
1200
1203
|
description: "Removes colors from the console output",
|
|
@@ -1225,6 +1228,7 @@ const cliOptionsConfig = {
|
|
|
1225
1228
|
array: true
|
|
1226
1229
|
},
|
|
1227
1230
|
strictTags: { description: "Should Vitest throw an error if test has a tag that is not defined in the config. (default: `true`)" },
|
|
1231
|
+
sharedViteServer: { description: "Let inline projects that don't modify the Vite config reuse the Vite server of the config that declares them. (default: `true`)" },
|
|
1228
1232
|
experimental: {
|
|
1229
1233
|
description: "Experimental features.",
|
|
1230
1234
|
argument: "<features>",
|
|
@@ -1274,9 +1278,20 @@ const cliOptionsConfig = {
|
|
|
1274
1278
|
description: "Custom provider for detecting changed files. (default: `git`)",
|
|
1275
1279
|
subcommands: null
|
|
1276
1280
|
},
|
|
1277
|
-
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`)" }
|
|
1281
|
+
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`)" },
|
|
1282
|
+
diagnostics: {
|
|
1283
|
+
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`)",
|
|
1284
|
+
argument: "",
|
|
1285
|
+
subcommands: {
|
|
1286
|
+
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`)" },
|
|
1287
|
+
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`)" },
|
|
1288
|
+
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`)" },
|
|
1289
|
+
transform: { description: "Print a hint when transforming modules dominates the run and `fsModuleCache` would persist the results across runs. (default: `true`)" }
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1278
1292
|
}
|
|
1279
1293
|
},
|
|
1294
|
+
// disable CLI options
|
|
1280
1295
|
cliExclude: null,
|
|
1281
1296
|
server: null,
|
|
1282
1297
|
setupFiles: null,
|
|
@@ -1333,7 +1348,7 @@ const collectCliOptionsConfig = {
|
|
|
1333
1348
|
}
|
|
1334
1349
|
};
|
|
1335
1350
|
|
|
1336
|
-
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,
|
|
1351
|
+
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;
|
|
1337
1352
|
|
|
1338
1353
|
function t(t,n){return `#compdef ${t}
|
|
1339
1354
|
compdef _${t} ${t}
|
|
@@ -1382,7 +1397,7 @@ _${t}() {
|
|
|
1382
1397
|
|
|
1383
1398
|
# Prepare the command to obtain completions, ensuring arguments are quoted for eval
|
|
1384
1399
|
local -a args_to_quote=("\${(@)words[2,-1]}")
|
|
1385
|
-
if [ "\${lastChar}" = "" ]; then
|
|
1400
|
+
if [ "\${lastChar}" = "" ] && [ "\${args_to_quote[-1]}" != "" ]; then
|
|
1386
1401
|
# If the last parameter is complete (there is a space following it)
|
|
1387
1402
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
|
1388
1403
|
__${t}_debug "Adding extra empty parameter"
|
|
@@ -1664,17 +1679,15 @@ function __${r}_perform_completion
|
|
|
1664
1679
|
|
|
1665
1680
|
# Extract all args except the last one
|
|
1666
1681
|
set -l args (commandline -opc)
|
|
1667
|
-
# Extract the
|
|
1668
|
-
set -l lastArg (
|
|
1682
|
+
# Extract the token currently being completed (may be empty on a trailing space)
|
|
1683
|
+
set -l lastArg (commandline -ct)
|
|
1669
1684
|
|
|
1670
1685
|
__${r}_debug "args: $args"
|
|
1671
1686
|
__${r}_debug "last arg: $lastArg"
|
|
1672
1687
|
|
|
1673
|
-
#
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
__${r}_debug "Calling $requestComp"
|
|
1677
|
-
set -l results (eval $requestComp 2> /dev/null)
|
|
1688
|
+
# 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.
|
|
1689
|
+
__${r}_debug "Calling ${n} complete -- $args[2..-1] $lastArg"
|
|
1690
|
+
set -l results (${n} complete -- $args[2..-1] "$lastArg" 2> /dev/null)
|
|
1678
1691
|
|
|
1679
1692
|
# Some programs may output extra empty lines after the directive.
|
|
1680
1693
|
# Let's ignore them or else it will break completion.
|
|
@@ -1955,8 +1968,10 @@ complete -k -c ${t} -n '__${r}_requires_order_preservation && __${r}_prepare_com
|
|
|
1955
1968
|
# Remove the flag part
|
|
1956
1969
|
$Flag, $WordToComplete = $WordToComplete.Split("=", 2)
|
|
1957
1970
|
}
|
|
1958
|
-
|
|
1959
|
-
|
|
1971
|
+
$HasTrailingEmptyArg = $QuotedArgs -match "(^| )''$"
|
|
1972
|
+
__${t}_debug "HasTrailingEmptyArg: $HasTrailingEmptyArg"
|
|
1973
|
+
|
|
1974
|
+
if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag ) -And ( -Not $HasTrailingEmptyArg )) {
|
|
1960
1975
|
# If the last parameter is complete (there is a space following it)
|
|
1961
1976
|
# We add an extra empty parameter so we can indicate this to the go method.
|
|
1962
1977
|
__${t}_debug "Adding extra empty parameter"
|
|
@@ -2136,10 +2151,10 @@ Register-ArgumentCompleter -CommandName '${t}' -ScriptBlock $__${r}CompleterBloc
|
|
|
2136
2151
|
|
|
2137
2152
|
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);}}
|
|
2138
2153
|
|
|
2139
|
-
const o=process.execPath,s=process.argv.slice(1),c
|
|
2154
|
+
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}
|
|
2140
2155
|
|
|
2141
2156
|
async function setupTabCompletions(cli) {
|
|
2142
|
-
await
|
|
2157
|
+
await l(cli, {
|
|
2143
2158
|
subCommands: {},
|
|
2144
2159
|
options: {
|
|
2145
2160
|
environment(complete) {
|
|
@@ -2273,6 +2288,7 @@ function createCLI(options = {}) {
|
|
|
2273
2288
|
cli.command("dev [...filters]", void 0, options).action(watch);
|
|
2274
2289
|
cli.command("bench [...filters]", void 0, options).action(benchmark);
|
|
2275
2290
|
cli.command("init <project>", void 0, options).action(init);
|
|
2291
|
+
cli.command("doctor [...filters]", void 0, options).action(doctorCommand);
|
|
2276
2292
|
addCliOptions(cli.command("list [...filters]", void 0, options).action((filters, options) => collect(filters, options)), collectCliOptionsConfig);
|
|
2277
2293
|
cli.command("[...filters]", void 0, options).action((filters, options) => start(filters, options));
|
|
2278
2294
|
setupTabCompletions(cli);
|
|
@@ -2347,11 +2363,11 @@ function normalizeCliOptions(cliFilters, argv) {
|
|
|
2347
2363
|
}
|
|
2348
2364
|
async function start(cliFilters, options) {
|
|
2349
2365
|
try {
|
|
2350
|
-
const { startVitest } = await import('./cli-api.
|
|
2366
|
+
const { startVitest } = await import('./cli-api.B4r6twmv.js').then(function (n) { return n.a; });
|
|
2351
2367
|
const ctx = await startVitest(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2352
2368
|
if (!ctx.shouldKeepServer()) await ctx.exit();
|
|
2353
2369
|
} catch (e) {
|
|
2354
|
-
const { errorBanner } = await import('./utils.
|
|
2370
|
+
const { errorBanner } = await import('./utils.DtdLoSPT.js').then(function (n) { return n.u; });
|
|
2355
2371
|
console.error(`\n${errorBanner("Startup Error")}`);
|
|
2356
2372
|
console.error(e);
|
|
2357
2373
|
console.error("\n\n");
|
|
@@ -2359,17 +2375,31 @@ async function start(cliFilters, options) {
|
|
|
2359
2375
|
process.exit();
|
|
2360
2376
|
}
|
|
2361
2377
|
}
|
|
2378
|
+
async function doctorCommand(cliFilters, options) {
|
|
2379
|
+
try {
|
|
2380
|
+
const { doctor } = await import('./doctor.oxixVMjH.js');
|
|
2381
|
+
await doctor(cliFilters.map(normalize), normalizeCliOptions(cliFilters, options));
|
|
2382
|
+
process.exit();
|
|
2383
|
+
} catch (e) {
|
|
2384
|
+
const { errorBanner } = await import('./utils.DtdLoSPT.js').then(function (n) { return n.u; });
|
|
2385
|
+
console.error(`\n${errorBanner("Doctor Error")}`);
|
|
2386
|
+
console.error(e);
|
|
2387
|
+
console.error("\n\n");
|
|
2388
|
+
process.exitCode ??= 1;
|
|
2389
|
+
process.exit();
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2362
2392
|
async function init(project) {
|
|
2363
2393
|
if (project !== "browser") {
|
|
2364
2394
|
console.error(/* @__PURE__ */ new Error("Only the \"browser\" project is supported. Use \"vitest init browser\" to create a new project."));
|
|
2365
2395
|
process.exit(1);
|
|
2366
2396
|
}
|
|
2367
|
-
const { create } = await import('./creator.
|
|
2397
|
+
const { create } = await import('./creator.BW8mSwbG.js');
|
|
2368
2398
|
await create();
|
|
2369
2399
|
}
|
|
2370
2400
|
async function collect(cliFilters, options) {
|
|
2371
2401
|
try {
|
|
2372
|
-
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.
|
|
2402
|
+
const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.B4r6twmv.js').then(function (n) { return n.a; });
|
|
2373
2403
|
const ctx = await prepareVitest({
|
|
2374
2404
|
...normalizeCliOptions(cliFilters, options),
|
|
2375
2405
|
watch: false,
|
|
@@ -2391,7 +2421,7 @@ async function collect(cliFilters, options) {
|
|
|
2391
2421
|
} else outputFileList(await ctx.getRelevantTestSpecifications(cliFilters.map(normalize)), options);
|
|
2392
2422
|
await ctx.close();
|
|
2393
2423
|
} catch (e) {
|
|
2394
|
-
const { errorBanner } = await import('./utils.
|
|
2424
|
+
const { errorBanner } = await import('./utils.DtdLoSPT.js').then(function (n) { return n.u; });
|
|
2395
2425
|
console.error(`\n${errorBanner("Collect Error")}`);
|
|
2396
2426
|
console.error(e);
|
|
2397
2427
|
console.error("\n\n");
|