@vitest/browser 4.1.1 → 4.1.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.
@@ -23,7 +23,7 @@
23
23
  })();
24
24
  </script>
25
25
  <!-- !LOAD_METADATA! -->
26
- <script type="module" src="./assets/index-C5TM4_dj.js"></script>
26
+ <script type="module" src="./assets/index-DflzHTY2.js"></script>
27
27
  <link rel="stylesheet" href="./assets/index-Da0hb3oU.css">
28
28
  </head>
29
29
  <body>
@@ -1,4 +1,4 @@
1
- import { g as getBrowserState, a as getConfig, r as relative, b as generateFileHash } from "./utils-Dsu9dGGg.js";
1
+ import { g as getBrowserState, a as getConfig, r as relative, b as generateFileHash } from "./utils-DmkAiRYk.js";
2
2
  import { channel, globalChannel, client } from "@vitest/browser/client";
3
3
  import { Traces } from "vitest/internal/browser";
4
4
  // @__NO_SIDE_EFFECTS__
@@ -1,4 +1,4 @@
1
- import { c as resolve, m as moduleRunner, d as getWorkerState, g as getBrowserState, e as getTestName, a as getConfig } from "./utils-Dsu9dGGg.js";
1
+ import { c as resolve, m as moduleRunner, d as getWorkerState, g as getBrowserState, e as getTestName, a as getConfig } from "./utils-DmkAiRYk.js";
2
2
  import { onCancel, globalChannel, channel, client } from "@vitest/browser/client";
3
3
  import { userEvent, page, server } from "vitest/browser";
4
4
  import { getSafeTimers, DecodedMap as DecodedMap$1, getOriginalPosition as getOriginalPosition$1, loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker, browserFormat, Traces, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, startTests, collectTests, SpyModule } from "vitest/internal/browser";
@@ -71,7 +71,7 @@ const resolver = (input, lazy, parsed, $) => (output) => {
71
71
  const k = ke[y];
72
72
  const value = output[k];
73
73
  if (value instanceof Primitive) {
74
- const tmp = input[value];
74
+ const tmp = input[+value];
75
75
  if (typeof tmp === object && !parsed.has(tmp)) {
76
76
  parsed.add(tmp);
77
77
  output[k] = ignore;
@@ -689,7 +689,9 @@ function createStackString(stacks) {
689
689
  function parseStacktrace(stack, options = {}) {
690
690
  const { ignoreStackEntries = stackIgnorePatterns } = options;
691
691
  let stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
692
- const helperIndex = stacks.findLastIndex((s) => s.method === "__VITEST_HELPER__" || s.method === "async*__VITEST_HELPER__");
692
+ const helperIndex = stacks.findLastIndex(
693
+ (s) => s.method === "__VITEST_HELPER__" || s.method === "async*__VITEST_HELPER__" || s.method === "async __VITEST_HELPER__"
694
+ );
693
695
  if (helperIndex >= 0) {
694
696
  stacks = stacks.slice(helperIndex + 1);
695
697
  }
@@ -911,13 +913,12 @@ function createBrowserRunner(runnerClass, mocker, state, coverageModule) {
911
913
  }
912
914
  };
913
915
  onTaskFinished = async (task) => {
914
- var _a, _b;
915
- if (this.config.browser.screenshotFailures && document.body.clientHeight > 0 && ((_a = task.result) == null ? void 0 : _a.state) === "fail" && task.type === "test" && task.artifacts.every(
916
- (artifact) => artifact.type !== "internal:toMatchScreenshot"
917
- )) {
916
+ var _a, _b, _c, _d, _e, _f;
917
+ const lastErrorContext = (_c = (_b = (_a = task.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.at(-1)) == null ? void 0 : _c.__vitest_error_context__;
918
+ if (this.config.browser.screenshotFailures && document.body.clientHeight > 0 && ((_d = task.result) == null ? void 0 : _d.state) === "fail" && task.type === "test" && !(lastErrorContext && Reflect.get(lastErrorContext, "assertionName") === "toMatchScreenshot" && ((_e = Reflect.get(lastErrorContext, "meta")) == null ? void 0 : _e.outcome) !== "unstable-screenshot")) {
918
919
  const screenshot = await page.screenshot(
919
920
  {
920
- timeout: ((_b = this.config.browser.providerOptions) == null ? void 0 : _b.actionTimeout) ?? 5e3
921
+ timeout: ((_f = this.config.browser.providerOptions) == null ? void 0 : _f.actionTimeout) ?? 5e3
921
922
  }
922
923
  /** TODO */
923
924
  ).catch((err) => {