@vitest/browser 4.0.10 → 4.0.12

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-DZIaN7GU.js"></script>
26
+ <script type="module" src="./assets/index-TGTX-jRo.js"></script>
27
27
  <link rel="stylesheet" href="./assets/index-VPnwgb7M.css">
28
28
  </head>
29
29
  <body>
@@ -971,25 +971,32 @@ function createBrowserRunner(runnerClass, mocker, state, coverageModule) {
971
971
  return rpc$2().onCollected(this.method, files);
972
972
  };
973
973
  onTestAnnotate = (test, annotation) => {
974
- if (annotation.location) {
975
- const map = this.sourceMapCache.get(annotation.location.file);
974
+ const artifact = { type: "internal:annotation", annotation, location: annotation.location };
975
+ return this.onTestArtifactRecord(test, artifact).then(({ annotation: annotation2 }) => annotation2);
976
+ };
977
+ onTestArtifactRecord = (test, artifact) => {
978
+ if (artifact.location) {
979
+ const map = this.sourceMapCache.get(artifact.location.file);
976
980
  if (!map) {
977
- return rpc$2().onTaskAnnotate(test.id, annotation);
981
+ return rpc$2().onTaskArtifactRecord(test.id, artifact);
978
982
  }
979
- const traceMap = new DecodedMap$1(map, annotation.location.file);
980
- const position = getOriginalPosition$1(traceMap, annotation.location);
983
+ const traceMap = new DecodedMap$1(map, artifact.location.file);
984
+ const position = getOriginalPosition$1(traceMap, artifact.location);
981
985
  if (position) {
982
986
  const { source, column, line } = position;
983
- const file = source || annotation.location.file;
984
- annotation.location = {
987
+ const file = source || artifact.location.file;
988
+ artifact.location = {
985
989
  line,
986
990
  column: column + 1,
987
991
  // if the file path is on windows, we need to remove the starting slash
988
992
  file: file.match(/\/\w:\//) ? file.slice(1) : file
989
993
  };
994
+ if (artifact.type === "internal:annotation") {
995
+ artifact.annotation.location = artifact.location;
996
+ }
990
997
  }
991
998
  }
992
- return rpc$2().onTaskAnnotate(test.id, annotation);
999
+ return rpc$2().onTaskArtifactRecord(test.id, artifact);
993
1000
  };
994
1001
  onTaskUpdate = (task, events) => {
995
1002
  return rpc$2().onTaskUpdate(this.method, task, events);
@@ -1016,6 +1023,9 @@ function createBrowserRunner(runnerClass, mocker, state, coverageModule) {
1016
1023
  throw new Error(`Failed to import test file ${filepath}`, { cause: err });
1017
1024
  }
1018
1025
  };
1026
+ // disable tracing in the browser for now
1027
+ trace = void 0;
1028
+ __setTraces = void 0;
1019
1029
  };
1020
1030
  }
1021
1031
  let cachedRunner = null;
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vitest Browser Tester</title>
8
- <script type="module" crossorigin src="/__vitest_browser__/tester-BH1P33_v.js"></script>
8
+ <script type="module" crossorigin src="/__vitest_browser__/tester-gw0ZBXrK.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-uxqdqUz8.js">
10
10
  </head>
11
11
  <body>
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import { PNG } from 'pngjs';
18
18
  import pm from 'pixelmatch';
19
19
  import { WebSocketServer } from 'ws';
20
20
 
21
- var version = "4.0.10";
21
+ var version = "4.0.12";
22
22
 
23
23
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
24
24
  function normalizeWindowsPath(input = "") {
@@ -2979,8 +2979,8 @@ function setupBrowserRpc(globalServer, defaultMockerRegistry) {
2979
2979
  await vitest._testRun.collected(project, files);
2980
2980
  }
2981
2981
  },
2982
- async onTaskAnnotate(id, annotation) {
2983
- return vitest._testRun.annotate(id, annotation);
2982
+ async onTaskArtifactRecord(id, artifact) {
2983
+ return vitest._testRun.recordArtifact(id, artifact);
2984
2984
  },
2985
2985
  async onTaskUpdate(method, packs, events) {
2986
2986
  if (method === "collect") {
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { MockedModuleSerialized, ServerIdResolution, ServerMockResolution } from "@vitest/mocker";
2
- import type { TaskEventPack, TaskResultPack, TestAnnotation } from "@vitest/runner";
2
+ import type { TaskEventPack, TaskResultPack, TestArtifact } from "@vitest/runner";
3
3
  import type { BirpcReturn } from "birpc";
4
4
  import type { AfterSuiteRunMeta, BrowserTesterOptions, CancelReason, RunnerTestFile, SerializedTestSpecification, SnapshotResult, TestExecutionMethod, UserConsoleLog } from "vitest";
5
5
  export interface WebSocketBrowserHandlers {
@@ -8,7 +8,7 @@ export interface WebSocketBrowserHandlers {
8
8
  onUnhandledError: (error: unknown, type: string) => Promise<void>;
9
9
  onQueued: (method: TestExecutionMethod, file: RunnerTestFile) => void;
10
10
  onCollected: (method: TestExecutionMethod, files: RunnerTestFile[]) => Promise<void>;
11
- onTaskAnnotate: (testId: string, annotation: TestAnnotation) => Promise<TestAnnotation>;
11
+ onTaskArtifactRecord: <Artifact extends TestArtifact>(testId: string, artifact: Artifact) => Promise<Artifact>;
12
12
  onTaskUpdate: (method: TestExecutionMethod, packs: TaskResultPack[], events: TaskEventPack[]) => void;
13
13
  onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
14
14
  cancelCurrentRun: (reason: CancelReason) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "4.0.10",
4
+ "version": "4.0.12",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -51,7 +51,7 @@
51
51
  "providers"
52
52
  ],
53
53
  "peerDependencies": {
54
- "vitest": "4.0.10"
54
+ "vitest": "4.0.12"
55
55
  },
56
56
  "dependencies": {
57
57
  "magic-string": "^0.30.21",
@@ -60,8 +60,8 @@
60
60
  "sirv": "^3.0.2",
61
61
  "tinyrainbow": "^3.0.3",
62
62
  "ws": "^8.18.3",
63
- "@vitest/mocker": "4.0.10",
64
- "@vitest/utils": "4.0.10"
63
+ "@vitest/mocker": "4.0.12",
64
+ "@vitest/utils": "4.0.12"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@testing-library/user-event": "^14.6.1",
@@ -72,8 +72,8 @@
72
72
  "ivya": "^1.7.0",
73
73
  "mime": "^4.1.0",
74
74
  "pathe": "^2.0.3",
75
- "@vitest/runner": "4.0.10",
76
- "vitest": "4.0.10"
75
+ "vitest": "4.0.12",
76
+ "@vitest/runner": "4.0.12"
77
77
  },
78
78
  "scripts": {
79
79
  "typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",