@vitest/browser 3.2.1 → 3.2.3

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.
@@ -770,11 +770,11 @@ function isNegativeNaN(val) {
770
770
  const isNegative = u32[1] >>> 31 === 1;
771
771
  return isNegative;
772
772
  }
773
- var jsTokens_1;
774
- var hasRequiredJsTokens;
775
- function requireJsTokens() {
776
- if (hasRequiredJsTokens) return jsTokens_1;
777
- hasRequiredJsTokens = 1;
773
+ var jsTokens_1$1;
774
+ var hasRequiredJsTokens$1;
775
+ function requireJsTokens$1() {
776
+ if (hasRequiredJsTokens$1) return jsTokens_1$1;
777
+ hasRequiredJsTokens$1 = 1;
778
778
  var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
779
779
  RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
780
780
  Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
@@ -795,7 +795,7 @@ function requireJsTokens() {
795
795
  KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
796
796
  KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
797
797
  Newline = RegExp(LineTerminatorSequence.source);
798
- jsTokens_1 = function* (input, { jsx = false } = {}) {
798
+ jsTokens_1$1 = function* (input, { jsx = false } = {}) {
799
799
  var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
800
800
  ({ length } = input);
801
801
  lastIndex = 0;
@@ -1161,9 +1161,9 @@ function requireJsTokens() {
1161
1161
  }
1162
1162
  return void 0;
1163
1163
  };
1164
- return jsTokens_1;
1164
+ return jsTokens_1$1;
1165
1165
  }
1166
- requireJsTokens();
1166
+ requireJsTokens$1();
1167
1167
  var reservedWords = {
1168
1168
  keyword: [
1169
1169
  "break",
@@ -1355,22 +1355,22 @@ function extractLocation(urlLike) {
1355
1355
  if (!parts) {
1356
1356
  return [urlLike];
1357
1357
  }
1358
- let url2 = parts[1];
1359
- if (url2.startsWith("async ")) {
1360
- url2 = url2.slice(6);
1358
+ let url = parts[1];
1359
+ if (url.startsWith("async ")) {
1360
+ url = url.slice(6);
1361
1361
  }
1362
- if (url2.startsWith("http:") || url2.startsWith("https:")) {
1363
- const urlObj = new URL(url2);
1362
+ if (url.startsWith("http:") || url.startsWith("https:")) {
1363
+ const urlObj = new URL(url);
1364
1364
  urlObj.searchParams.delete("import");
1365
1365
  urlObj.searchParams.delete("browserv");
1366
- url2 = urlObj.pathname + urlObj.hash + urlObj.search;
1366
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
1367
1367
  }
1368
- if (url2.startsWith("/@fs/")) {
1369
- const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url2);
1370
- url2 = url2.slice(isWindows ? 5 : 4);
1368
+ if (url.startsWith("/@fs/")) {
1369
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
1370
+ url = url.slice(isWindows ? 5 : 4);
1371
1371
  }
1372
1372
  return [
1373
- url2,
1373
+ url,
1374
1374
  parts[2] || void 0,
1375
1375
  parts[3] || void 0
1376
1376
  ];
@@ -1389,12 +1389,12 @@ function parseSingleFFOrSafariStack(raw) {
1389
1389
  const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(@)/;
1390
1390
  const matches = line.match(functionNameRegex);
1391
1391
  const functionName = matches && matches[1] ? matches[1] : void 0;
1392
- const [url2, lineNumber, columnNumber] = extractLocation(line.replace(functionNameRegex, ""));
1393
- if (!url2 || !lineNumber || !columnNumber) {
1392
+ const [url, lineNumber, columnNumber] = extractLocation(line.replace(functionNameRegex, ""));
1393
+ if (!url || !lineNumber || !columnNumber) {
1394
1394
  return null;
1395
1395
  }
1396
1396
  return {
1397
- file: url2,
1397
+ file: url,
1398
1398
  method: functionName || "",
1399
1399
  line: Number.parseInt(lineNumber),
1400
1400
  column: Number.parseInt(columnNumber)
@@ -1416,11 +1416,11 @@ function parseSingleV8Stack(raw) {
1416
1416
  line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
1417
1417
  }
1418
1418
  let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
1419
- const location2 = sanitizedLine.match(/ (\(.+\)$)/);
1420
- sanitizedLine = location2 ? sanitizedLine.replace(location2[0], "") : sanitizedLine;
1421
- const [url2, lineNumber, columnNumber] = extractLocation(location2 ? location2[1] : sanitizedLine);
1422
- let method = location2 && sanitizedLine || "";
1423
- let file = url2 && ["eval", "<anonymous>"].includes(url2) ? void 0 : url2;
1419
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
1420
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
1421
+ const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
1422
+ let method = location && sanitizedLine || "";
1423
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
1424
1424
  if (!file || !lineNumber || !columnNumber) {
1425
1425
  return null;
1426
1426
  }
@@ -1441,6 +1441,486 @@ function parseSingleV8Stack(raw) {
1441
1441
  column: Number.parseInt(columnNumber)
1442
1442
  };
1443
1443
  }
1444
+ function getDefaultExportFromCjs(x) {
1445
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1446
+ }
1447
+ var jsTokens_1;
1448
+ var hasRequiredJsTokens;
1449
+ function requireJsTokens() {
1450
+ if (hasRequiredJsTokens) return jsTokens_1;
1451
+ hasRequiredJsTokens = 1;
1452
+ var HashbangComment, Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
1453
+ RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
1454
+ Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
1455
+ Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;
1456
+ StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;
1457
+ NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
1458
+ Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;
1459
+ WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu;
1460
+ LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
1461
+ MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;
1462
+ SingleLineComment = /\/\/.*/y;
1463
+ HashbangComment = /^#!.*/;
1464
+ JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
1465
+ JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;
1466
+ JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;
1467
+ JSXText = /[^<>{}]+/y;
1468
+ TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
1469
+ TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
1470
+ KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
1471
+ KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
1472
+ Newline = RegExp(LineTerminatorSequence.source);
1473
+ jsTokens_1 = function* (input, { jsx = false } = {}) {
1474
+ var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
1475
+ ({ length } = input);
1476
+ lastIndex = 0;
1477
+ lastSignificantToken = "";
1478
+ stack = [
1479
+ { tag: "JS" }
1480
+ ];
1481
+ braces = [];
1482
+ parenNesting = 0;
1483
+ postfixIncDec = false;
1484
+ if (match = HashbangComment.exec(input)) {
1485
+ yield {
1486
+ type: "HashbangComment",
1487
+ value: match[0]
1488
+ };
1489
+ lastIndex = match[0].length;
1490
+ }
1491
+ while (lastIndex < length) {
1492
+ mode = stack[stack.length - 1];
1493
+ switch (mode.tag) {
1494
+ case "JS":
1495
+ case "JSNonExpressionParen":
1496
+ case "InterpolationInTemplate":
1497
+ case "InterpolationInJSX":
1498
+ if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
1499
+ RegularExpressionLiteral.lastIndex = lastIndex;
1500
+ if (match = RegularExpressionLiteral.exec(input)) {
1501
+ lastIndex = RegularExpressionLiteral.lastIndex;
1502
+ lastSignificantToken = match[0];
1503
+ postfixIncDec = true;
1504
+ yield {
1505
+ type: "RegularExpressionLiteral",
1506
+ value: match[0],
1507
+ closed: match[1] !== void 0 && match[1] !== "\\"
1508
+ };
1509
+ continue;
1510
+ }
1511
+ }
1512
+ Punctuator.lastIndex = lastIndex;
1513
+ if (match = Punctuator.exec(input)) {
1514
+ punctuator = match[0];
1515
+ nextLastIndex = Punctuator.lastIndex;
1516
+ nextLastSignificantToken = punctuator;
1517
+ switch (punctuator) {
1518
+ case "(":
1519
+ if (lastSignificantToken === "?NonExpressionParenKeyword") {
1520
+ stack.push({
1521
+ tag: "JSNonExpressionParen",
1522
+ nesting: parenNesting
1523
+ });
1524
+ }
1525
+ parenNesting++;
1526
+ postfixIncDec = false;
1527
+ break;
1528
+ case ")":
1529
+ parenNesting--;
1530
+ postfixIncDec = true;
1531
+ if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
1532
+ stack.pop();
1533
+ nextLastSignificantToken = "?NonExpressionParenEnd";
1534
+ postfixIncDec = false;
1535
+ }
1536
+ break;
1537
+ case "{":
1538
+ Punctuator.lastIndex = 0;
1539
+ isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
1540
+ braces.push(isExpression);
1541
+ postfixIncDec = false;
1542
+ break;
1543
+ case "}":
1544
+ switch (mode.tag) {
1545
+ case "InterpolationInTemplate":
1546
+ if (braces.length === mode.nesting) {
1547
+ Template.lastIndex = lastIndex;
1548
+ match = Template.exec(input);
1549
+ lastIndex = Template.lastIndex;
1550
+ lastSignificantToken = match[0];
1551
+ if (match[1] === "${") {
1552
+ lastSignificantToken = "?InterpolationInTemplate";
1553
+ postfixIncDec = false;
1554
+ yield {
1555
+ type: "TemplateMiddle",
1556
+ value: match[0]
1557
+ };
1558
+ } else {
1559
+ stack.pop();
1560
+ postfixIncDec = true;
1561
+ yield {
1562
+ type: "TemplateTail",
1563
+ value: match[0],
1564
+ closed: match[1] === "`"
1565
+ };
1566
+ }
1567
+ continue;
1568
+ }
1569
+ break;
1570
+ case "InterpolationInJSX":
1571
+ if (braces.length === mode.nesting) {
1572
+ stack.pop();
1573
+ lastIndex += 1;
1574
+ lastSignificantToken = "}";
1575
+ yield {
1576
+ type: "JSXPunctuator",
1577
+ value: "}"
1578
+ };
1579
+ continue;
1580
+ }
1581
+ }
1582
+ postfixIncDec = braces.pop();
1583
+ nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
1584
+ break;
1585
+ case "]":
1586
+ postfixIncDec = true;
1587
+ break;
1588
+ case "++":
1589
+ case "--":
1590
+ nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
1591
+ break;
1592
+ case "<":
1593
+ if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
1594
+ stack.push({ tag: "JSXTag" });
1595
+ lastIndex += 1;
1596
+ lastSignificantToken = "<";
1597
+ yield {
1598
+ type: "JSXPunctuator",
1599
+ value: punctuator
1600
+ };
1601
+ continue;
1602
+ }
1603
+ postfixIncDec = false;
1604
+ break;
1605
+ default:
1606
+ postfixIncDec = false;
1607
+ }
1608
+ lastIndex = nextLastIndex;
1609
+ lastSignificantToken = nextLastSignificantToken;
1610
+ yield {
1611
+ type: "Punctuator",
1612
+ value: punctuator
1613
+ };
1614
+ continue;
1615
+ }
1616
+ Identifier.lastIndex = lastIndex;
1617
+ if (match = Identifier.exec(input)) {
1618
+ lastIndex = Identifier.lastIndex;
1619
+ nextLastSignificantToken = match[0];
1620
+ switch (match[0]) {
1621
+ case "for":
1622
+ case "if":
1623
+ case "while":
1624
+ case "with":
1625
+ if (lastSignificantToken !== "." && lastSignificantToken !== "?.") {
1626
+ nextLastSignificantToken = "?NonExpressionParenKeyword";
1627
+ }
1628
+ }
1629
+ lastSignificantToken = nextLastSignificantToken;
1630
+ postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
1631
+ yield {
1632
+ type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
1633
+ value: match[0]
1634
+ };
1635
+ continue;
1636
+ }
1637
+ StringLiteral.lastIndex = lastIndex;
1638
+ if (match = StringLiteral.exec(input)) {
1639
+ lastIndex = StringLiteral.lastIndex;
1640
+ lastSignificantToken = match[0];
1641
+ postfixIncDec = true;
1642
+ yield {
1643
+ type: "StringLiteral",
1644
+ value: match[0],
1645
+ closed: match[2] !== void 0
1646
+ };
1647
+ continue;
1648
+ }
1649
+ NumericLiteral.lastIndex = lastIndex;
1650
+ if (match = NumericLiteral.exec(input)) {
1651
+ lastIndex = NumericLiteral.lastIndex;
1652
+ lastSignificantToken = match[0];
1653
+ postfixIncDec = true;
1654
+ yield {
1655
+ type: "NumericLiteral",
1656
+ value: match[0]
1657
+ };
1658
+ continue;
1659
+ }
1660
+ Template.lastIndex = lastIndex;
1661
+ if (match = Template.exec(input)) {
1662
+ lastIndex = Template.lastIndex;
1663
+ lastSignificantToken = match[0];
1664
+ if (match[1] === "${") {
1665
+ lastSignificantToken = "?InterpolationInTemplate";
1666
+ stack.push({
1667
+ tag: "InterpolationInTemplate",
1668
+ nesting: braces.length
1669
+ });
1670
+ postfixIncDec = false;
1671
+ yield {
1672
+ type: "TemplateHead",
1673
+ value: match[0]
1674
+ };
1675
+ } else {
1676
+ postfixIncDec = true;
1677
+ yield {
1678
+ type: "NoSubstitutionTemplate",
1679
+ value: match[0],
1680
+ closed: match[1] === "`"
1681
+ };
1682
+ }
1683
+ continue;
1684
+ }
1685
+ break;
1686
+ case "JSXTag":
1687
+ case "JSXTagEnd":
1688
+ JSXPunctuator.lastIndex = lastIndex;
1689
+ if (match = JSXPunctuator.exec(input)) {
1690
+ lastIndex = JSXPunctuator.lastIndex;
1691
+ nextLastSignificantToken = match[0];
1692
+ switch (match[0]) {
1693
+ case "<":
1694
+ stack.push({ tag: "JSXTag" });
1695
+ break;
1696
+ case ">":
1697
+ stack.pop();
1698
+ if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
1699
+ nextLastSignificantToken = "?JSX";
1700
+ postfixIncDec = true;
1701
+ } else {
1702
+ stack.push({ tag: "JSXChildren" });
1703
+ }
1704
+ break;
1705
+ case "{":
1706
+ stack.push({
1707
+ tag: "InterpolationInJSX",
1708
+ nesting: braces.length
1709
+ });
1710
+ nextLastSignificantToken = "?InterpolationInJSX";
1711
+ postfixIncDec = false;
1712
+ break;
1713
+ case "/":
1714
+ if (lastSignificantToken === "<") {
1715
+ stack.pop();
1716
+ if (stack[stack.length - 1].tag === "JSXChildren") {
1717
+ stack.pop();
1718
+ }
1719
+ stack.push({ tag: "JSXTagEnd" });
1720
+ }
1721
+ }
1722
+ lastSignificantToken = nextLastSignificantToken;
1723
+ yield {
1724
+ type: "JSXPunctuator",
1725
+ value: match[0]
1726
+ };
1727
+ continue;
1728
+ }
1729
+ JSXIdentifier.lastIndex = lastIndex;
1730
+ if (match = JSXIdentifier.exec(input)) {
1731
+ lastIndex = JSXIdentifier.lastIndex;
1732
+ lastSignificantToken = match[0];
1733
+ yield {
1734
+ type: "JSXIdentifier",
1735
+ value: match[0]
1736
+ };
1737
+ continue;
1738
+ }
1739
+ JSXString.lastIndex = lastIndex;
1740
+ if (match = JSXString.exec(input)) {
1741
+ lastIndex = JSXString.lastIndex;
1742
+ lastSignificantToken = match[0];
1743
+ yield {
1744
+ type: "JSXString",
1745
+ value: match[0],
1746
+ closed: match[2] !== void 0
1747
+ };
1748
+ continue;
1749
+ }
1750
+ break;
1751
+ case "JSXChildren":
1752
+ JSXText.lastIndex = lastIndex;
1753
+ if (match = JSXText.exec(input)) {
1754
+ lastIndex = JSXText.lastIndex;
1755
+ lastSignificantToken = match[0];
1756
+ yield {
1757
+ type: "JSXText",
1758
+ value: match[0]
1759
+ };
1760
+ continue;
1761
+ }
1762
+ switch (input[lastIndex]) {
1763
+ case "<":
1764
+ stack.push({ tag: "JSXTag" });
1765
+ lastIndex++;
1766
+ lastSignificantToken = "<";
1767
+ yield {
1768
+ type: "JSXPunctuator",
1769
+ value: "<"
1770
+ };
1771
+ continue;
1772
+ case "{":
1773
+ stack.push({
1774
+ tag: "InterpolationInJSX",
1775
+ nesting: braces.length
1776
+ });
1777
+ lastIndex++;
1778
+ lastSignificantToken = "?InterpolationInJSX";
1779
+ postfixIncDec = false;
1780
+ yield {
1781
+ type: "JSXPunctuator",
1782
+ value: "{"
1783
+ };
1784
+ continue;
1785
+ }
1786
+ }
1787
+ WhiteSpace.lastIndex = lastIndex;
1788
+ if (match = WhiteSpace.exec(input)) {
1789
+ lastIndex = WhiteSpace.lastIndex;
1790
+ yield {
1791
+ type: "WhiteSpace",
1792
+ value: match[0]
1793
+ };
1794
+ continue;
1795
+ }
1796
+ LineTerminatorSequence.lastIndex = lastIndex;
1797
+ if (match = LineTerminatorSequence.exec(input)) {
1798
+ lastIndex = LineTerminatorSequence.lastIndex;
1799
+ postfixIncDec = false;
1800
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
1801
+ lastSignificantToken = "?NoLineTerminatorHere";
1802
+ }
1803
+ yield {
1804
+ type: "LineTerminatorSequence",
1805
+ value: match[0]
1806
+ };
1807
+ continue;
1808
+ }
1809
+ MultiLineComment.lastIndex = lastIndex;
1810
+ if (match = MultiLineComment.exec(input)) {
1811
+ lastIndex = MultiLineComment.lastIndex;
1812
+ if (Newline.test(match[0])) {
1813
+ postfixIncDec = false;
1814
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
1815
+ lastSignificantToken = "?NoLineTerminatorHere";
1816
+ }
1817
+ }
1818
+ yield {
1819
+ type: "MultiLineComment",
1820
+ value: match[0],
1821
+ closed: match[1] !== void 0
1822
+ };
1823
+ continue;
1824
+ }
1825
+ SingleLineComment.lastIndex = lastIndex;
1826
+ if (match = SingleLineComment.exec(input)) {
1827
+ lastIndex = SingleLineComment.lastIndex;
1828
+ postfixIncDec = false;
1829
+ yield {
1830
+ type: "SingleLineComment",
1831
+ value: match[0]
1832
+ };
1833
+ continue;
1834
+ }
1835
+ firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
1836
+ lastIndex += firstCodePoint.length;
1837
+ lastSignificantToken = firstCodePoint;
1838
+ postfixIncDec = false;
1839
+ yield {
1840
+ type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
1841
+ value: firstCodePoint
1842
+ };
1843
+ }
1844
+ return void 0;
1845
+ };
1846
+ return jsTokens_1;
1847
+ }
1848
+ var jsTokensExports = requireJsTokens();
1849
+ const jsTokens = /* @__PURE__ */ getDefaultExportFromCjs(jsTokensExports);
1850
+ function stripLiteralJsTokens(code, options) {
1851
+ const FILL = " ";
1852
+ const FILL_COMMENT = " ";
1853
+ let result = "";
1854
+ const tokens = [];
1855
+ for (const token of jsTokens(code, { jsx: false })) {
1856
+ tokens.push(token);
1857
+ if (token.type === "SingleLineComment") {
1858
+ result += FILL_COMMENT.repeat(token.value.length);
1859
+ continue;
1860
+ }
1861
+ if (token.type === "MultiLineComment") {
1862
+ result += token.value.replace(/[^\n]/g, FILL_COMMENT);
1863
+ continue;
1864
+ }
1865
+ if (token.type === "StringLiteral") {
1866
+ if (!token.closed) {
1867
+ result += token.value;
1868
+ continue;
1869
+ }
1870
+ const body = token.value.slice(1, -1);
1871
+ {
1872
+ result += token.value[0] + FILL.repeat(body.length) + token.value[token.value.length - 1];
1873
+ continue;
1874
+ }
1875
+ }
1876
+ if (token.type === "NoSubstitutionTemplate") {
1877
+ const body = token.value.slice(1, -1);
1878
+ {
1879
+ result += `\`${body.replace(/[^\n]/g, FILL)}\``;
1880
+ continue;
1881
+ }
1882
+ }
1883
+ if (token.type === "RegularExpressionLiteral") {
1884
+ const body = token.value;
1885
+ {
1886
+ result += body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${FILL.repeat($1.length)}/${$2}`);
1887
+ continue;
1888
+ }
1889
+ }
1890
+ if (token.type === "TemplateHead") {
1891
+ const body = token.value.slice(1, -2);
1892
+ {
1893
+ result += `\`${body.replace(/[^\n]/g, FILL)}\${`;
1894
+ continue;
1895
+ }
1896
+ }
1897
+ if (token.type === "TemplateTail") {
1898
+ const body = token.value.slice(0, -2);
1899
+ {
1900
+ result += `}${body.replace(/[^\n]/g, FILL)}\``;
1901
+ continue;
1902
+ }
1903
+ }
1904
+ if (token.type === "TemplateMiddle") {
1905
+ const body = token.value.slice(1, -2);
1906
+ {
1907
+ result += `}${body.replace(/[^\n]/g, FILL)}\${`;
1908
+ continue;
1909
+ }
1910
+ }
1911
+ result += token.value;
1912
+ }
1913
+ return {
1914
+ result,
1915
+ tokens
1916
+ };
1917
+ }
1918
+ function stripLiteral(code, options) {
1919
+ return stripLiteralDetailed(code).result;
1920
+ }
1921
+ function stripLiteralDetailed(code, options) {
1922
+ return stripLiteralJsTokens(code);
1923
+ }
1444
1924
  class PendingError extends Error {
1445
1925
  constructor(message, task, note) {
1446
1926
  super(message);
@@ -1671,7 +2151,7 @@ function resolveDeps(fixtures, depSet = /* @__PURE__ */ new Set(), pendingFixtur
1671
2151
  return pendingFixtures;
1672
2152
  }
1673
2153
  function getUsedProps(fn) {
1674
- let fnString = fn.toString();
2154
+ let fnString = stripLiteral(fn.toString());
1675
2155
  if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) {
1676
2156
  fnString = fnString.split(/__async\((?:this|null),/)[1];
1677
2157
  }
@@ -1857,7 +2337,7 @@ function createSuiteCollector(name, factory = () => {
1857
2337
  }
1858
2338
  if (runner.config.includeTaskLocation) {
1859
2339
  const error = stackTraceError.stack;
1860
- const stack = findTestFileStackTrace(error, task2.each ?? false);
2340
+ const stack = findTestFileStackTrace(error);
1861
2341
  if (stack) {
1862
2342
  task2.location = stack;
1863
2343
  }
@@ -2166,14 +2646,15 @@ function formatTemplateString(cases, args) {
2166
2646
  }
2167
2647
  return res;
2168
2648
  }
2169
- function findTestFileStackTrace(error, each) {
2649
+ function findTestFileStackTrace(error) {
2650
+ const testFilePath = getTestFilepath();
2170
2651
  const lines = error.split("\n").slice(1);
2171
2652
  for (const line of lines) {
2172
2653
  const stack = parseSingleStack(line);
2173
- if (stack && stack.file === getTestFilepath()) {
2654
+ if (stack && stack.file === testFilePath) {
2174
2655
  return {
2175
2656
  line: stack.line,
2176
- column: each ? stack.column + 1 : stack.column
2657
+ column: stack.column
2177
2658
  };
2178
2659
  }
2179
2660
  }
@@ -2192,6 +2673,7 @@ function generateHash(str) {
2192
2673
  }
2193
2674
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2194
2675
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2676
+ getSafeTimers();
2195
2677
  const packs = /* @__PURE__ */ new Map();
2196
2678
  const eventsPacks = [];
2197
2679
  const pendingTasksUpdates = [];
@@ -2314,7 +2796,7 @@ function createTestContext(test, runner2) {
2314
2796
  test.result.pending = true;
2315
2797
  throw new PendingError("test is skipped; abort execution", test, typeof condition === "string" ? condition : note);
2316
2798
  };
2317
- async function annotate(message, location2, type, attachment) {
2799
+ async function annotate(message, location, type, attachment) {
2318
2800
  const annotation = {
2319
2801
  message,
2320
2802
  type: type || "notice"
@@ -2331,8 +2813,8 @@ function createTestContext(test, runner2) {
2331
2813
  attachment.body = encodeUint8Array(attachment.body);
2332
2814
  }
2333
2815
  }
2334
- if (location2) {
2335
- annotation.location = location2;
2816
+ if (location) {
2817
+ annotation.location = location;
2336
2818
  }
2337
2819
  if (!runner2.onTestAnnotate) {
2338
2820
  throw new Error(`Test runner doesn't support test annotations.`);
@@ -2346,22 +2828,22 @@ function createTestContext(test, runner2) {
2346
2828
  if (test.result && test.result.state !== "run") {
2347
2829
  throw new Error(`Cannot annotate tests outside of the test run. The test "${test.name}" finished running with the "${test.result.state}" state already.`);
2348
2830
  }
2349
- let location2;
2831
+ let location;
2350
2832
  const stack = new Error("STACK_TRACE").stack;
2351
2833
  const index = stack.includes("STACK_TRACE") ? 2 : 1;
2352
2834
  const stackLine = stack.split("\n")[index];
2353
2835
  const parsed = parseSingleStack(stackLine);
2354
2836
  if (parsed) {
2355
- location2 = {
2837
+ location = {
2356
2838
  file: parsed.file,
2357
2839
  line: parsed.line,
2358
2840
  column: parsed.column
2359
2841
  };
2360
2842
  }
2361
2843
  if (typeof type === "object") {
2362
- return recordAsyncAnnotation(test, annotate(message, location2, void 0, type));
2844
+ return recordAsyncAnnotation(test, annotate(message, location, void 0, type));
2363
2845
  } else {
2364
- return recordAsyncAnnotation(test, annotate(message, location2, type, attachment));
2846
+ return recordAsyncAnnotation(test, annotate(message, location, type, attachment));
2365
2847
  }
2366
2848
  };
2367
2849
  context.onTestFailed = (handler, timeout) => {
@@ -2451,7 +2933,6 @@ function recordAsyncAnnotation(test, promise) {
2451
2933
  function getUiAPI() {
2452
2934
  return window.__vitest_ui_api__;
2453
2935
  }
2454
- const url = new URL(location.href);
2455
2936
  const ID_ALL = "__vitest_all__";
2456
2937
  class IframeOrchestrator {
2457
2938
  constructor() {
@@ -2529,7 +3010,7 @@ class IframeOrchestrator {
2529
3010
  }
2530
3011
  if (!this.iframes.has(ID_ALL)) {
2531
3012
  debug("preparing non-isolated iframe");
2532
- await this.prepareIframe(container, ID_ALL);
3013
+ await this.prepareIframe(container, ID_ALL, options.startTime);
2533
3014
  }
2534
3015
  const config = getConfig();
2535
3016
  const { width, height } = config.browser.viewport;
@@ -2551,7 +3032,7 @@ class IframeOrchestrator {
2551
3032
  this.iframes.get(file).remove();
2552
3033
  this.iframes.delete(file);
2553
3034
  }
2554
- const iframe = await this.prepareIframe(container, file);
3035
+ const iframe = await this.prepareIframe(container, file, options.startTime);
2555
3036
  await setIframeViewport(iframe, width, height);
2556
3037
  await sendEventToIframe({
2557
3038
  event: "execute",
@@ -2565,7 +3046,7 @@ class IframeOrchestrator {
2565
3046
  iframeId: file
2566
3047
  });
2567
3048
  }
2568
- async prepareIframe(container, iframeId) {
3049
+ async prepareIframe(container, iframeId, startTime) {
2569
3050
  const iframe = this.createTestIframe(iframeId);
2570
3051
  container.appendChild(iframe);
2571
3052
  await new Promise((resolve2, reject) => {
@@ -2573,7 +3054,8 @@ class IframeOrchestrator {
2573
3054
  this.iframes.set(iframeId, iframe);
2574
3055
  sendEventToIframe({
2575
3056
  event: "prepare",
2576
- iframeId
3057
+ iframeId,
3058
+ startTime
2577
3059
  }).then(resolve2, reject);
2578
3060
  };
2579
3061
  iframe.onerror = (e) => {
@@ -2590,7 +3072,7 @@ class IframeOrchestrator {
2590
3072
  }
2591
3073
  createTestIframe(iframeId) {
2592
3074
  const iframe = document.createElement("iframe");
2593
- const src = `${url.pathname}__vitest_test__/__test__/?sessionId=${getBrowserState().sessionId}&iframeId=${iframeId}`;
3075
+ const src = `/?sessionId=${getBrowserState().sessionId}&iframeId=${iframeId}`;
2594
3076
  iframe.setAttribute("loading", "eager");
2595
3077
  iframe.setAttribute("src", src);
2596
3078
  iframe.setAttribute("data-vitest", "true");