@vitest/snapshot 5.0.0-beta.2 → 5.0.0-beta.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.
package/dist/index.d.ts CHANGED
@@ -27,7 +27,9 @@ interface AssertDomainOptions extends Omit<AssertOptions, "received"> {
27
27
  adapter: DomainSnapshotAdapter<any, any>;
28
28
  }
29
29
  interface AssertDomainPollOptions extends Omit<AssertDomainOptions, "received"> {
30
- poll: () => Promise<unknown> | unknown;
30
+ poll: (options: {
31
+ signal: AbortSignal;
32
+ }) => Promise<unknown> | unknown;
31
33
  timeout?: number;
32
34
  interval?: number;
33
35
  }
package/dist/index.js CHANGED
@@ -1058,10 +1058,14 @@ class SnapshotClient {
1058
1058
  inlineSnapshot
1059
1059
  });
1060
1060
  const reference = expectedSnapshot.data !== undefined && snapshotState.snapshotUpdateState !== "all" ? adapter.parseExpected(expectedSnapshot.data) : undefined;
1061
- const timedOut = timeout > 0 ? new Promise((r) => setTimeout(r, timeout)) : undefined;
1061
+ const timeoutController = new AbortController();
1062
+ const timedOut = timeout > 0 ? new Promise((r) => setTimeout(() => {
1063
+ timeoutController.abort();
1064
+ r();
1065
+ }, timeout)) : undefined;
1062
1066
  const stableResult = await getStableSnapshot({
1063
1067
  adapter,
1064
- poll,
1068
+ poll: () => poll({ signal: timeoutController.signal }),
1065
1069
  interval,
1066
1070
  timedOut,
1067
1071
  match: reference ? (captured) => adapter.match(captured, reference).pass : undefined
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/snapshot",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.2",
4
+ "version": "5.0.0-beta.3",
5
5
  "description": "Vitest snapshot manager",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -48,8 +48,8 @@
48
48
  "dependencies": {
49
49
  "magic-string": "^0.30.21",
50
50
  "pathe": "^2.0.3",
51
- "@vitest/pretty-format": "5.0.0-beta.2",
52
- "@vitest/utils": "5.0.0-beta.2"
51
+ "@vitest/pretty-format": "5.0.0-beta.3",
52
+ "@vitest/utils": "5.0.0-beta.3"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/natural-compare": "^1.4.3",