@vitest/browser 3.0.0-beta.4 → 3.0.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/dist/client/.vite/manifest.json +6 -6
- package/dist/client/__vitest__/assets/index-D9z-wtyx.js +52 -0
- package/dist/client/__vitest__/assets/index-GEF0wBOB.css +1 -0
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-Cv-bzUFk.js → orchestrator-vOivV83Y.js} +1 -1
- package/dist/client/__vitest_browser__/{tester-DreAh6ar.js → tester-COSVU_mu.js} +37 -41
- package/dist/client/__vitest_browser__/{utils-CaCTRFti.js → utils-Owv5OOOf.js} +0 -2
- package/dist/client/esm-client-injector.js +1 -0
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/tester/tester.html +2 -2
- package/dist/client.js +5 -4
- package/dist/context.js +2 -2
- package/dist/{index-Dos_sf7B.js → index--cbQOwRJ.js} +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +149 -178
- package/dist/locators/index.js +2 -2
- package/dist/locators/playwright.js +2 -2
- package/dist/locators/preview.js +2 -2
- package/dist/locators/webdriverio.js +2 -2
- package/dist/providers.js +1 -1
- package/dist/{public-utils-D6S2-5kI.js → public-utils-DldpEzVw.js} +99 -99
- package/dist/utils.js +1 -1
- package/dist/{webdriver-dkCg9pjp.js → webdriver-kh_HHy0p.js} +4 -0
- package/package.json +11 -11
- package/dist/client/__vitest__/assets/index-BC8TFRpg.js +0 -52
- package/dist/client/__vitest__/assets/index-D1v_Nqq1.css +0 -1
package/dist/index.js
CHANGED
|
@@ -11,12 +11,12 @@ import { fileURLToPath } from 'node:url';
|
|
|
11
11
|
import crypto from 'node:crypto';
|
|
12
12
|
import { mkdir, readFile as readFile$1 } from 'node:fs/promises';
|
|
13
13
|
import { parseErrorStacktrace, parseStacktrace } from '@vitest/utils/source-map';
|
|
14
|
-
import { P as PlaywrightBrowserProvider, W as WebdriverBrowserProvider } from './webdriver-
|
|
14
|
+
import { P as PlaywrightBrowserProvider, W as WebdriverBrowserProvider } from './webdriver-kh_HHy0p.js';
|
|
15
15
|
import { resolve as resolve$1, dirname as dirname$1, basename as basename$1, normalize as normalize$1 } from 'node:path';
|
|
16
16
|
import { WebSocketServer } from 'ws';
|
|
17
17
|
import * as nodeos from 'node:os';
|
|
18
18
|
|
|
19
|
-
var version = "3.0.
|
|
19
|
+
var version = "3.0.1";
|
|
20
20
|
|
|
21
21
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
22
22
|
function normalizeWindowsPath(input = "") {
|
|
@@ -31,7 +31,6 @@ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
|
31
31
|
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
32
32
|
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
33
33
|
const _EXTNAME_RE = /.(\.[^./]+)$/;
|
|
34
|
-
globalThis.process?.platform === "win32" ? ";" : ":";
|
|
35
34
|
const normalize = function(path) {
|
|
36
35
|
if (path.length === 0) {
|
|
37
36
|
return ".";
|
|
@@ -262,6 +261,7 @@ async function resolveOrchestrator(globalServer, url, res) {
|
|
|
262
261
|
__VITEST_VITE_CONFIG__: JSON.stringify({
|
|
263
262
|
root: browserProject.vite.config.root
|
|
264
263
|
}),
|
|
264
|
+
__VITEST_METHOD__: JSON.stringify(session?.method || "run"),
|
|
265
265
|
__VITEST_FILES__: JSON.stringify(files),
|
|
266
266
|
__VITEST_TYPE__: '"orchestrator"',
|
|
267
267
|
__VITEST_SESSION_ID__: JSON.stringify(sessionId),
|
|
@@ -415,7 +415,7 @@ const parse = (text, reviver) => {
|
|
|
415
415
|
*/
|
|
416
416
|
const stringify = (value, replacer, space) => {
|
|
417
417
|
const $ = replacer && typeof replacer === object ?
|
|
418
|
-
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v :
|
|
418
|
+
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : undefined) :
|
|
419
419
|
(replacer || noop);
|
|
420
420
|
const known = new Map;
|
|
421
421
|
const input = [];
|
|
@@ -479,6 +479,7 @@ async function resolveTester(globalServer, url, res, next) {
|
|
|
479
479
|
root: browserProject.vite.config.root
|
|
480
480
|
}),
|
|
481
481
|
__VITEST_TYPE__: '"tester"',
|
|
482
|
+
__VITEST_METHOD__: JSON.stringify(method),
|
|
482
483
|
__VITEST_SESSION_ID__: JSON.stringify(sessionId),
|
|
483
484
|
__VITEST_TESTER_ID__: JSON.stringify(crypto.randomUUID()),
|
|
484
485
|
__VITEST_PROVIDED_CONTEXT__: JSON.stringify(stringify(project.getProvidedContext()))
|
|
@@ -623,7 +624,7 @@ var BrowserPlugin = (parentServer, base = "/") => {
|
|
|
623
624
|
}
|
|
624
625
|
);
|
|
625
626
|
const coverageFolder = resolveCoverageFolder(parentServer.vitest);
|
|
626
|
-
const coveragePath = coverageFolder ? coverageFolder[1] :
|
|
627
|
+
const coveragePath = coverageFolder ? coverageFolder[1] : undefined;
|
|
627
628
|
if (coveragePath && base === coveragePath) {
|
|
628
629
|
throw new Error(
|
|
629
630
|
`The ui base path and the coverage path cannot be the same: ${base}, change coverage.reportsDirectory`
|
|
@@ -777,6 +778,14 @@ var BrowserPlugin = (parentServer, base = "/") => {
|
|
|
777
778
|
if (svelte) {
|
|
778
779
|
exclude.push("vitest-browser-svelte");
|
|
779
780
|
}
|
|
781
|
+
const vue = isPackageExists("vitest-browser-vue", fileRoot);
|
|
782
|
+
if (vue) {
|
|
783
|
+
include.push(
|
|
784
|
+
"vitest-browser-vue",
|
|
785
|
+
"vitest-browser-vue > @vue/test-utils",
|
|
786
|
+
"vitest-browser-vue > @vue/test-utils > @vue/compiler-core"
|
|
787
|
+
);
|
|
788
|
+
}
|
|
780
789
|
const vueTestUtils = isPackageExists("@vue/test-utils", fileRoot);
|
|
781
790
|
if (vueTestUtils) {
|
|
782
791
|
include.push("@vue/test-utils");
|
|
@@ -1029,9 +1038,8 @@ body {
|
|
|
1029
1038
|
{
|
|
1030
1039
|
name: "test-utils-rewrite",
|
|
1031
1040
|
setup(build) {
|
|
1032
|
-
build.onResolve({ filter: /^@vue\/test-utils$/ }, (args) => {
|
|
1033
|
-
const
|
|
1034
|
-
const resolved = _require2.resolve(args.path, {
|
|
1041
|
+
build.onResolve({ filter: /^@vue\/(test-utils|compiler-core)$/ }, (args) => {
|
|
1042
|
+
const resolved = getRequire().resolve(args.path, {
|
|
1035
1043
|
paths: [args.importer]
|
|
1036
1044
|
});
|
|
1037
1045
|
return { path: resolved };
|
|
@@ -1051,7 +1059,7 @@ function tryResolve(path, paths) {
|
|
|
1051
1059
|
const _require2 = getRequire();
|
|
1052
1060
|
return _require2.resolve(path, { paths });
|
|
1053
1061
|
} catch {
|
|
1054
|
-
return
|
|
1062
|
+
return undefined;
|
|
1055
1063
|
}
|
|
1056
1064
|
}
|
|
1057
1065
|
let _require;
|
|
@@ -1068,15 +1076,15 @@ function resolveCoverageFolder(vitest) {
|
|
|
1068
1076
|
return reporter === "html";
|
|
1069
1077
|
}
|
|
1070
1078
|
return reporter[0] === "html";
|
|
1071
|
-
}) :
|
|
1079
|
+
}) : undefined;
|
|
1072
1080
|
if (!htmlReporter) {
|
|
1073
|
-
return
|
|
1081
|
+
return undefined;
|
|
1074
1082
|
}
|
|
1075
1083
|
const root = resolve(
|
|
1076
1084
|
options.root || process.cwd(),
|
|
1077
1085
|
options.coverage.reportsDirectory || coverageConfigDefaults.reportsDirectory
|
|
1078
1086
|
);
|
|
1079
|
-
const subdir = Array.isArray(htmlReporter) && htmlReporter.length > 1 && "subdir" in htmlReporter[1] ? htmlReporter[1].subdir :
|
|
1087
|
+
const subdir = Array.isArray(htmlReporter) && htmlReporter.length > 1 && "subdir" in htmlReporter[1] ? htmlReporter[1].subdir : undefined;
|
|
1080
1088
|
if (!subdir || typeof subdir !== "string") {
|
|
1081
1089
|
return [root, `/${basename(root)}/`];
|
|
1082
1090
|
}
|
|
@@ -1707,157 +1715,13 @@ const hover = async (context, selector, options = {}) => {
|
|
|
1707
1715
|
}
|
|
1708
1716
|
};
|
|
1709
1717
|
|
|
1710
|
-
var
|
|
1711
|
-
(function(clickableInputTypes) {
|
|
1712
|
-
clickableInputTypes["button"] = "button";
|
|
1713
|
-
clickableInputTypes["color"] = "color";
|
|
1714
|
-
clickableInputTypes["file"] = "file";
|
|
1715
|
-
clickableInputTypes["image"] = "image";
|
|
1716
|
-
clickableInputTypes["reset"] = "reset";
|
|
1717
|
-
clickableInputTypes["submit"] = "submit";
|
|
1718
|
-
clickableInputTypes["checkbox"] = "checkbox";
|
|
1719
|
-
clickableInputTypes["radio"] = "radio";
|
|
1720
|
-
})(clickableInputTypes || (clickableInputTypes = {}));
|
|
1721
|
-
|
|
1722
|
-
var editableInputTypes;
|
|
1723
|
-
(function(editableInputTypes) {
|
|
1724
|
-
editableInputTypes["text"] = "text";
|
|
1725
|
-
editableInputTypes["date"] = "date";
|
|
1726
|
-
editableInputTypes["datetime-local"] = "datetime-local";
|
|
1727
|
-
editableInputTypes["email"] = "email";
|
|
1728
|
-
editableInputTypes["month"] = "month";
|
|
1729
|
-
editableInputTypes["number"] = "number";
|
|
1730
|
-
editableInputTypes["password"] = "password";
|
|
1731
|
-
editableInputTypes["search"] = "search";
|
|
1732
|
-
editableInputTypes["tel"] = "tel";
|
|
1733
|
-
editableInputTypes["time"] = "time";
|
|
1734
|
-
editableInputTypes["url"] = "url";
|
|
1735
|
-
editableInputTypes["week"] = "week";
|
|
1736
|
-
})(editableInputTypes || (editableInputTypes = {}));
|
|
1737
|
-
|
|
1738
|
-
var maxLengthSupportedTypes;
|
|
1739
|
-
(function(maxLengthSupportedTypes) {
|
|
1740
|
-
maxLengthSupportedTypes["email"] = "email";
|
|
1741
|
-
maxLengthSupportedTypes["password"] = "password";
|
|
1742
|
-
maxLengthSupportedTypes["search"] = "search";
|
|
1743
|
-
maxLengthSupportedTypes["telephone"] = "telephone";
|
|
1744
|
-
maxLengthSupportedTypes["text"] = "text";
|
|
1745
|
-
maxLengthSupportedTypes["url"] = "url";
|
|
1746
|
-
})(maxLengthSupportedTypes || (maxLengthSupportedTypes = {}));
|
|
1747
|
-
|
|
1748
|
-
var bracketDict;
|
|
1749
|
-
(function(bracketDict) {
|
|
1750
|
-
bracketDict["{"] = "}";
|
|
1751
|
-
bracketDict["["] = "]";
|
|
1752
|
-
})(bracketDict || (bracketDict = {}));
|
|
1753
|
-
/**
|
|
1754
|
-
* Read the next key definition from user input
|
|
1755
|
-
*
|
|
1756
|
-
* Describe key per `{descriptor}` or `[descriptor]`.
|
|
1757
|
-
* Everything else will be interpreted as a single character as descriptor - e.g. `a`.
|
|
1758
|
-
* Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
|
|
1759
|
-
* A previously pressed key can be released per `{/descriptor}`.
|
|
1760
|
-
* Keeping the key pressed can be written as `{descriptor>}`.
|
|
1761
|
-
* When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
|
|
1762
|
-
* You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
|
|
1763
|
-
*/ function readNextDescriptor(text, context) {
|
|
1764
|
-
let pos = 0;
|
|
1765
|
-
const startBracket = text[pos] in bracketDict ? text[pos] : '';
|
|
1766
|
-
pos += startBracket.length;
|
|
1767
|
-
const isEscapedChar = new RegExp(`^\\${startBracket}{2}`).test(text);
|
|
1768
|
-
const type = isEscapedChar ? '' : startBracket;
|
|
1769
|
-
return {
|
|
1770
|
-
type,
|
|
1771
|
-
...type === '' ? readPrintableChar(text, pos) : readTag(text, pos, type)
|
|
1772
|
-
};
|
|
1773
|
-
}
|
|
1774
|
-
function readPrintableChar(text, pos, context) {
|
|
1775
|
-
const descriptor = text[pos];
|
|
1776
|
-
assertDescriptor(descriptor, text, pos);
|
|
1777
|
-
pos += descriptor.length;
|
|
1778
|
-
return {
|
|
1779
|
-
consumedLength: pos,
|
|
1780
|
-
descriptor,
|
|
1781
|
-
releasePrevious: false,
|
|
1782
|
-
releaseSelf: true,
|
|
1783
|
-
repeat: 1
|
|
1784
|
-
};
|
|
1785
|
-
}
|
|
1786
|
-
function readTag(text, pos, startBracket, context) {
|
|
1787
|
-
var _text_slice_match, _text_slice_match1;
|
|
1788
|
-
const releasePreviousModifier = text[pos] === '/' ? '/' : '';
|
|
1789
|
-
pos += releasePreviousModifier.length;
|
|
1790
|
-
const escapedDescriptor = startBracket === '{' && text[pos] === '\\';
|
|
1791
|
-
pos += Number(escapedDescriptor);
|
|
1792
|
-
const descriptor = escapedDescriptor ? text[pos] : (_text_slice_match = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || _text_slice_match === void 0 ? void 0 : _text_slice_match[0];
|
|
1793
|
-
assertDescriptor(descriptor, text, pos);
|
|
1794
|
-
pos += descriptor.length;
|
|
1795
|
-
var _text_slice_match_;
|
|
1796
|
-
const repeatModifier = (_text_slice_match_ = (_text_slice_match1 = text.slice(pos).match(/^>\d+/)) === null || _text_slice_match1 === void 0 ? void 0 : _text_slice_match1[0]) !== null && _text_slice_match_ !== void 0 ? _text_slice_match_ : '';
|
|
1797
|
-
pos += repeatModifier.length;
|
|
1798
|
-
const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : '';
|
|
1799
|
-
pos += releaseSelfModifier.length;
|
|
1800
|
-
const expectedEndBracket = bracketDict[startBracket];
|
|
1801
|
-
const endBracket = text[pos] === expectedEndBracket ? expectedEndBracket : '';
|
|
1802
|
-
if (!endBracket) {
|
|
1803
|
-
throw new Error(getErrorMessage([
|
|
1804
|
-
!repeatModifier && 'repeat modifier',
|
|
1805
|
-
!releaseSelfModifier && 'release modifier',
|
|
1806
|
-
`"${expectedEndBracket}"`
|
|
1807
|
-
].filter(Boolean).join(' or '), text[pos], text));
|
|
1808
|
-
}
|
|
1809
|
-
pos += endBracket.length;
|
|
1810
|
-
return {
|
|
1811
|
-
consumedLength: pos,
|
|
1812
|
-
descriptor,
|
|
1813
|
-
releasePrevious: !!releasePreviousModifier,
|
|
1814
|
-
repeat: repeatModifier ? Math.max(Number(repeatModifier.substr(1)), 1) : 1,
|
|
1815
|
-
releaseSelf: hasReleaseSelf(releaseSelfModifier, repeatModifier)
|
|
1816
|
-
};
|
|
1817
|
-
}
|
|
1818
|
-
function assertDescriptor(descriptor, text, pos, context) {
|
|
1819
|
-
if (!descriptor) {
|
|
1820
|
-
throw new Error(getErrorMessage('key descriptor', text[pos], text));
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
|
|
1824
|
-
if (releaseSelfModifier) {
|
|
1825
|
-
return releaseSelfModifier === '/';
|
|
1826
|
-
}
|
|
1827
|
-
if (repeatModifier) {
|
|
1828
|
-
return false;
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
function getErrorMessage(expected, found, text, context) {
|
|
1832
|
-
return `Expected ${expected} but found "${found !== null && found !== void 0 ? found : ''}" in "${text}"
|
|
1833
|
-
See ${`https://testing-library.com/docs/user-event/keyboard`}
|
|
1834
|
-
for more information about how userEvent parses your input.`;
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
var ApiLevel;
|
|
1838
|
-
(function(ApiLevel) {
|
|
1839
|
-
ApiLevel[ApiLevel["Trigger"] = 2] = "Trigger";
|
|
1840
|
-
ApiLevel[ApiLevel["Call"] = 1] = "Call";
|
|
1841
|
-
})(ApiLevel || (ApiLevel = {}));
|
|
1842
|
-
|
|
1843
|
-
var PointerEventsCheckLevel;
|
|
1844
|
-
(function(PointerEventsCheckLevel) {
|
|
1845
|
-
/**
|
|
1846
|
-
* Check pointer events on every user interaction that triggers a bunch of events.
|
|
1847
|
-
* E.g. once for releasing a mouse button even though this triggers `pointerup`, `mouseup`, `click`, etc...
|
|
1848
|
-
*/ PointerEventsCheckLevel[PointerEventsCheckLevel["EachTrigger"] = 4] = "EachTrigger";
|
|
1849
|
-
/** Check each target once per call to pointer (related) API */ PointerEventsCheckLevel[PointerEventsCheckLevel["EachApiCall"] = 2] = "EachApiCall";
|
|
1850
|
-
/** Check each event target once */ PointerEventsCheckLevel[PointerEventsCheckLevel["EachTarget"] = 1] = "EachTarget";
|
|
1851
|
-
/** No pointer events check */ PointerEventsCheckLevel[PointerEventsCheckLevel["Never"] = 0] = "Never";
|
|
1852
|
-
})(PointerEventsCheckLevel || (PointerEventsCheckLevel = {}));
|
|
1853
|
-
|
|
1854
|
-
var DOM_KEY_LOCATION;
|
|
1855
|
-
(function(DOM_KEY_LOCATION) {
|
|
1718
|
+
var DOM_KEY_LOCATION = /*#__PURE__*/ function(DOM_KEY_LOCATION) {
|
|
1856
1719
|
DOM_KEY_LOCATION[DOM_KEY_LOCATION["STANDARD"] = 0] = "STANDARD";
|
|
1857
1720
|
DOM_KEY_LOCATION[DOM_KEY_LOCATION["LEFT"] = 1] = "LEFT";
|
|
1858
1721
|
DOM_KEY_LOCATION[DOM_KEY_LOCATION["RIGHT"] = 2] = "RIGHT";
|
|
1859
1722
|
DOM_KEY_LOCATION[DOM_KEY_LOCATION["NUMPAD"] = 3] = "NUMPAD";
|
|
1860
|
-
|
|
1723
|
+
return DOM_KEY_LOCATION;
|
|
1724
|
+
}({});
|
|
1861
1725
|
|
|
1862
1726
|
/**
|
|
1863
1727
|
* Mapping for a default US-104-QWERTY keyboard
|
|
@@ -2010,6 +1874,95 @@ var DOM_KEY_LOCATION;
|
|
|
2010
1874
|
}
|
|
2011
1875
|
];
|
|
2012
1876
|
|
|
1877
|
+
var bracketDict = /*#__PURE__*/ function(bracketDict) {
|
|
1878
|
+
bracketDict["{"] = "}";
|
|
1879
|
+
bracketDict["["] = "]";
|
|
1880
|
+
return bracketDict;
|
|
1881
|
+
}(bracketDict || {});
|
|
1882
|
+
/**
|
|
1883
|
+
* Read the next key definition from user input
|
|
1884
|
+
*
|
|
1885
|
+
* Describe key per `{descriptor}` or `[descriptor]`.
|
|
1886
|
+
* Everything else will be interpreted as a single character as descriptor - e.g. `a`.
|
|
1887
|
+
* Brackets `{` and `[` can be escaped by doubling - e.g. `foo[[bar` translates to `foo[bar`.
|
|
1888
|
+
* A previously pressed key can be released per `{/descriptor}`.
|
|
1889
|
+
* Keeping the key pressed can be written as `{descriptor>}`.
|
|
1890
|
+
* When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
|
|
1891
|
+
* You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
|
|
1892
|
+
*/ function readNextDescriptor(text, context) {
|
|
1893
|
+
let pos = 0;
|
|
1894
|
+
const startBracket = text[pos] in bracketDict ? text[pos] : '';
|
|
1895
|
+
pos += startBracket.length;
|
|
1896
|
+
const isEscapedChar = new RegExp(`^\\${startBracket}{2}`).test(text);
|
|
1897
|
+
const type = isEscapedChar ? '' : startBracket;
|
|
1898
|
+
return {
|
|
1899
|
+
type,
|
|
1900
|
+
...type === '' ? readPrintableChar(text, pos) : readTag(text, pos, type)
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
function readPrintableChar(text, pos, context) {
|
|
1904
|
+
const descriptor = text[pos];
|
|
1905
|
+
assertDescriptor(descriptor, text, pos);
|
|
1906
|
+
pos += descriptor.length;
|
|
1907
|
+
return {
|
|
1908
|
+
consumedLength: pos,
|
|
1909
|
+
descriptor,
|
|
1910
|
+
releasePrevious: false,
|
|
1911
|
+
releaseSelf: true,
|
|
1912
|
+
repeat: 1
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
function readTag(text, pos, startBracket, context) {
|
|
1916
|
+
var _text_slice_match, _text_slice_match1;
|
|
1917
|
+
const releasePreviousModifier = text[pos] === '/' ? '/' : '';
|
|
1918
|
+
pos += releasePreviousModifier.length;
|
|
1919
|
+
const escapedDescriptor = startBracket === '{' && text[pos] === '\\';
|
|
1920
|
+
pos += Number(escapedDescriptor);
|
|
1921
|
+
const descriptor = escapedDescriptor ? text[pos] : (_text_slice_match = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || _text_slice_match === undefined ? undefined : _text_slice_match[0];
|
|
1922
|
+
assertDescriptor(descriptor, text, pos);
|
|
1923
|
+
pos += descriptor.length;
|
|
1924
|
+
var _text_slice_match_;
|
|
1925
|
+
const repeatModifier = (_text_slice_match_ = (_text_slice_match1 = text.slice(pos).match(/^>\d+/)) === null || _text_slice_match1 === undefined ? undefined : _text_slice_match1[0]) !== null && _text_slice_match_ !== undefined ? _text_slice_match_ : '';
|
|
1926
|
+
pos += repeatModifier.length;
|
|
1927
|
+
const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : '';
|
|
1928
|
+
pos += releaseSelfModifier.length;
|
|
1929
|
+
const expectedEndBracket = bracketDict[startBracket];
|
|
1930
|
+
const endBracket = text[pos] === expectedEndBracket ? expectedEndBracket : '';
|
|
1931
|
+
if (!endBracket) {
|
|
1932
|
+
throw new Error(getErrorMessage([
|
|
1933
|
+
!repeatModifier && 'repeat modifier',
|
|
1934
|
+
!releaseSelfModifier && 'release modifier',
|
|
1935
|
+
`"${expectedEndBracket}"`
|
|
1936
|
+
].filter(Boolean).join(' or '), text[pos], text));
|
|
1937
|
+
}
|
|
1938
|
+
pos += endBracket.length;
|
|
1939
|
+
return {
|
|
1940
|
+
consumedLength: pos,
|
|
1941
|
+
descriptor,
|
|
1942
|
+
releasePrevious: !!releasePreviousModifier,
|
|
1943
|
+
repeat: repeatModifier ? Math.max(Number(repeatModifier.substr(1)), 1) : 1,
|
|
1944
|
+
releaseSelf: hasReleaseSelf(releaseSelfModifier, repeatModifier)
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
function assertDescriptor(descriptor, text, pos, context) {
|
|
1948
|
+
if (!descriptor) {
|
|
1949
|
+
throw new Error(getErrorMessage('key descriptor', text[pos], text));
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
|
|
1953
|
+
if (releaseSelfModifier) {
|
|
1954
|
+
return releaseSelfModifier === '/';
|
|
1955
|
+
}
|
|
1956
|
+
if (repeatModifier) {
|
|
1957
|
+
return false;
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
function getErrorMessage(expected, found, text, context) {
|
|
1961
|
+
return `Expected ${expected} but found "${found !== null && found !== undefined ? found : ''}" in "${text}"
|
|
1962
|
+
See ${`https://testing-library.com/docs/user-event/keyboard`}
|
|
1963
|
+
for more information about how userEvent parses your input.`;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
2013
1966
|
/**
|
|
2014
1967
|
* Parse key defintions per `keyboardMap`
|
|
2015
1968
|
*
|
|
@@ -2027,13 +1980,13 @@ var DOM_KEY_LOCATION;
|
|
|
2027
1980
|
const keyDef = (_keyboardMap_find = keyboardMap.find((def)=>{
|
|
2028
1981
|
if (type === '[') {
|
|
2029
1982
|
var _def_code;
|
|
2030
|
-
return ((_def_code = def.code) === null || _def_code ===
|
|
1983
|
+
return ((_def_code = def.code) === null || _def_code === undefined ? undefined : _def_code.toLowerCase()) === descriptor.toLowerCase();
|
|
2031
1984
|
} else if (type === '{') {
|
|
2032
1985
|
var _def_key;
|
|
2033
|
-
return ((_def_key = def.key) === null || _def_key ===
|
|
1986
|
+
return ((_def_key = def.key) === null || _def_key === undefined ? undefined : _def_key.toLowerCase()) === descriptor.toLowerCase();
|
|
2034
1987
|
}
|
|
2035
1988
|
return def.key === descriptor;
|
|
2036
|
-
})) !== null && _keyboardMap_find !==
|
|
1989
|
+
})) !== null && _keyboardMap_find !== undefined ? _keyboardMap_find : {
|
|
2037
1990
|
key: 'Unknown',
|
|
2038
1991
|
code: 'Unknown',
|
|
2039
1992
|
[type === '[' ? 'code' : 'key']: descriptor
|
|
@@ -2479,7 +2432,7 @@ function wrapConfig(config) {
|
|
|
2479
2432
|
return {
|
|
2480
2433
|
...config,
|
|
2481
2434
|
// workaround RegExp serialization
|
|
2482
|
-
testNamePattern: config.testNamePattern ? config.testNamePattern.toString() :
|
|
2435
|
+
testNamePattern: config.testNamePattern ? config.testNamePattern.toString() : undefined
|
|
2483
2436
|
};
|
|
2484
2437
|
}
|
|
2485
2438
|
|
|
@@ -2632,7 +2585,7 @@ class ParentBrowserProject {
|
|
|
2632
2585
|
const server = this.vite;
|
|
2633
2586
|
const promises = scripts.map(
|
|
2634
2587
|
async ({ content, src, async, id, type = "module" }, index) => {
|
|
2635
|
-
const srcLink = (src ? (await server.pluginContainer.resolveId(src))?.id :
|
|
2588
|
+
const srcLink = (src ? (await server.pluginContainer.resolveId(src))?.id : undefined) || src;
|
|
2636
2589
|
const transformId = srcLink || join(server.config.root, `virtual__${id || `injected-${index}.js`}`);
|
|
2637
2590
|
await server.moduleGraph.ensureEntryFromUrl(transformId);
|
|
2638
2591
|
const contentProcessed = content && type === "module" ? (await server.pluginContainer.transform(content, transformId)).code : content;
|
|
@@ -2689,7 +2642,7 @@ function createBirpc(functions, options) {
|
|
|
2689
2642
|
if (method === "$close")
|
|
2690
2643
|
return close;
|
|
2691
2644
|
if (method === "then" && !eventNames.includes("then") && !("then" in functions))
|
|
2692
|
-
return
|
|
2645
|
+
return undefined;
|
|
2693
2646
|
const sendEvent = (...args) => {
|
|
2694
2647
|
post(serialize({ m: method, a: args, t: "q" }));
|
|
2695
2648
|
};
|
|
@@ -2704,7 +2657,7 @@ function createBirpc(functions, options) {
|
|
|
2704
2657
|
try {
|
|
2705
2658
|
await _promise;
|
|
2706
2659
|
} finally {
|
|
2707
|
-
_promise =
|
|
2660
|
+
_promise = undefined;
|
|
2708
2661
|
}
|
|
2709
2662
|
}
|
|
2710
2663
|
return new Promise((resolve, reject) => {
|
|
@@ -2812,6 +2765,12 @@ function setupBrowserRpc(globalServer) {
|
|
|
2812
2765
|
new Error(`[vitest] Invalid URL ${request.url}. "projectName", "sessionId" and "rpcId" queries are required.`)
|
|
2813
2766
|
);
|
|
2814
2767
|
}
|
|
2768
|
+
const method = searchParams.get("method");
|
|
2769
|
+
if (method !== "run" && method !== "collect") {
|
|
2770
|
+
return error(
|
|
2771
|
+
new Error(`[vitest] Method query in ${request.url} is invalid. Method should be either "run" or "collect".`)
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2815
2774
|
if (type === "orchestrator") {
|
|
2816
2775
|
const session = vitest._browserSessions.getSession(sessionId);
|
|
2817
2776
|
session?.connected();
|
|
@@ -2824,7 +2783,7 @@ function setupBrowserRpc(globalServer) {
|
|
|
2824
2783
|
}
|
|
2825
2784
|
wss.handleUpgrade(request, socket, head, (ws) => {
|
|
2826
2785
|
wss.emit("connection", ws, request);
|
|
2827
|
-
const rpc = setupClient(project, rpcId, ws);
|
|
2786
|
+
const rpc = setupClient(project, rpcId, ws, method);
|
|
2828
2787
|
const state = project.browser.state;
|
|
2829
2788
|
const clients = type === "tester" ? state.testers : state.orchestrators;
|
|
2830
2789
|
clients.set(rpcId, rpc);
|
|
@@ -2847,7 +2806,7 @@ function setupBrowserRpc(globalServer) {
|
|
|
2847
2806
|
);
|
|
2848
2807
|
}
|
|
2849
2808
|
}
|
|
2850
|
-
function setupClient(project, rpcId, ws) {
|
|
2809
|
+
function setupClient(project, rpcId, ws, method) {
|
|
2851
2810
|
const mockResolver = new ServerMockResolver(globalServer.vite, {
|
|
2852
2811
|
moduleDirectories: project.config.server?.deps?.moduleDirectories
|
|
2853
2812
|
});
|
|
@@ -2861,23 +2820,35 @@ function setupBrowserRpc(globalServer) {
|
|
|
2861
2820
|
vitest.state.catchError(error2, type);
|
|
2862
2821
|
},
|
|
2863
2822
|
async onQueued(file) {
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2823
|
+
if (method === "collect") {
|
|
2824
|
+
vitest.state.collectFiles(project, [file]);
|
|
2825
|
+
} else {
|
|
2826
|
+
await vitest._testRun.enqueued(project, file);
|
|
2827
|
+
}
|
|
2867
2828
|
},
|
|
2868
2829
|
async onCollected(files) {
|
|
2869
|
-
|
|
2870
|
-
|
|
2830
|
+
if (method === "collect") {
|
|
2831
|
+
vitest.state.collectFiles(project, files);
|
|
2832
|
+
} else {
|
|
2833
|
+
await vitest._testRun.collected(project, files);
|
|
2834
|
+
}
|
|
2871
2835
|
},
|
|
2872
|
-
async onTaskUpdate(packs) {
|
|
2873
|
-
|
|
2874
|
-
|
|
2836
|
+
async onTaskUpdate(packs, events) {
|
|
2837
|
+
if (method === "collect") {
|
|
2838
|
+
vitest.state.updateTasks(packs);
|
|
2839
|
+
} else {
|
|
2840
|
+
await vitest._testRun.updated(packs, events);
|
|
2841
|
+
}
|
|
2875
2842
|
},
|
|
2876
2843
|
onAfterSuiteRun(meta) {
|
|
2877
2844
|
vitest.coverageProvider?.onAfterSuiteRun(meta);
|
|
2878
2845
|
},
|
|
2879
|
-
sendLog(log) {
|
|
2880
|
-
|
|
2846
|
+
async sendLog(log) {
|
|
2847
|
+
if (method === "collect") {
|
|
2848
|
+
vitest.state.updateUserLog(log);
|
|
2849
|
+
} else {
|
|
2850
|
+
await vitest._testRun.log(log);
|
|
2851
|
+
}
|
|
2881
2852
|
},
|
|
2882
2853
|
resolveSnapshotPath(testPath) {
|
|
2883
2854
|
return vitest.snapshot.resolvePath(testPath, {
|
package/dist/locators/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@vitest/browser/context';
|
|
2
|
-
import '../public-utils-
|
|
3
|
-
export { L as Locator, s as selectorEngine } from '../index
|
|
2
|
+
import '../public-utils-DldpEzVw.js';
|
|
3
|
+
export { L as Locator, s as selectorEngine } from '../index--cbQOwRJ.js';
|
|
4
4
|
import 'vitest/utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { page, server } from '@vitest/browser/context';
|
|
2
|
-
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector } from '../public-utils-
|
|
3
|
-
import { s as selectorEngine, L as Locator } from '../index
|
|
2
|
+
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector } from '../public-utils-DldpEzVw.js';
|
|
3
|
+
import { s as selectorEngine, L as Locator } from '../index--cbQOwRJ.js';
|
|
4
4
|
import 'vitest/utils';
|
|
5
5
|
|
|
6
6
|
page.extend({
|
package/dist/locators/preview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { page, server, userEvent } from '@vitest/browser/context';
|
|
2
|
-
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector, h as getElementError } from '../public-utils-
|
|
3
|
-
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index
|
|
2
|
+
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector, h as getElementError } from '../public-utils-DldpEzVw.js';
|
|
3
|
+
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index--cbQOwRJ.js';
|
|
4
4
|
import 'vitest/utils';
|
|
5
5
|
|
|
6
6
|
page.extend({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { page, server } from '@vitest/browser/context';
|
|
2
|
-
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector, h as getElementError } from '../public-utils-
|
|
3
|
-
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index
|
|
2
|
+
import { g as getByLabelSelector, a as getByRoleSelector, b as getByTestIdSelector, c as getByAltTextSelector, d as getByPlaceholderSelector, e as getByTextSelector, f as getByTitleSelector, h as getElementError } from '../public-utils-DldpEzVw.js';
|
|
3
|
+
import { s as selectorEngine, L as Locator, c as convertElementToCssSelector } from '../index--cbQOwRJ.js';
|
|
4
4
|
import 'vitest/utils';
|
|
5
5
|
|
|
6
6
|
page.extend({
|
package/dist/providers.js
CHANGED