@vitest/snapshot 3.0.7 → 3.0.9

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.
@@ -0,0 +1,22 @@
1
+ interface ParsedStack {
2
+ method: string;
3
+ file: string;
4
+ line: number;
5
+ column: number;
6
+ }
7
+
8
+ interface SnapshotEnvironment {
9
+ getVersion: () => string;
10
+ getHeader: () => string;
11
+ resolvePath: (filepath: string) => Promise<string>;
12
+ resolveRawPath: (testPath: string, rawPath: string) => Promise<string>;
13
+ saveSnapshotFile: (filepath: string, snapshot: string) => Promise<void>;
14
+ readSnapshotFile: (filepath: string) => Promise<string | null>;
15
+ removeSnapshotFile: (filepath: string) => Promise<void>;
16
+ processStackTrace?: (stack: ParsedStack) => ParsedStack;
17
+ }
18
+ interface SnapshotEnvironmentOptions {
19
+ snapshotsDirName?: string;
20
+ }
21
+
22
+ export type { ParsedStack as P, SnapshotEnvironment as S, SnapshotEnvironmentOptions as a };
@@ -1,16 +1,16 @@
1
- import { S as SnapshotEnvironment, a as SnapshotEnvironmentOptions } from './environment-Ddx0EDtY.js';
1
+ import { S as SnapshotEnvironment, a as SnapshotEnvironmentOptions } from './environment.d-DHdQ1Csl.js';
2
2
 
3
3
  declare class NodeSnapshotEnvironment implements SnapshotEnvironment {
4
- private options;
5
- constructor(options?: SnapshotEnvironmentOptions);
6
- getVersion(): string;
7
- getHeader(): string;
8
- resolveRawPath(testPath: string, rawPath: string): Promise<string>;
9
- resolvePath(filepath: string): Promise<string>;
10
- prepareDirectory(dirPath: string): Promise<void>;
11
- saveSnapshotFile(filepath: string, snapshot: string): Promise<void>;
12
- readSnapshotFile(filepath: string): Promise<string | null>;
13
- removeSnapshotFile(filepath: string): Promise<void>;
4
+ private options;
5
+ constructor(options?: SnapshotEnvironmentOptions);
6
+ getVersion(): string;
7
+ getHeader(): string;
8
+ resolveRawPath(testPath: string, rawPath: string): Promise<string>;
9
+ resolvePath(filepath: string): Promise<string>;
10
+ prepareDirectory(dirPath: string): Promise<void>;
11
+ saveSnapshotFile(filepath: string, snapshot: string): Promise<void>;
12
+ readSnapshotFile(filepath: string): Promise<string | null>;
13
+ removeSnapshotFile(filepath: string): Promise<void>;
14
14
  }
15
15
 
16
16
  export { NodeSnapshotEnvironment, SnapshotEnvironment };
package/dist/index.d.ts CHANGED
@@ -1,139 +1,128 @@
1
- import { S as SnapshotStateOptions, a as SnapshotMatchOptions, b as SnapshotResult, R as RawSnapshotInfo } from './rawSnapshot-DOKg5unn.js';
2
- export { c as SnapshotData, d as SnapshotSerializer, e as SnapshotSummary, f as SnapshotUpdateState, U as UncheckedSnapshot } from './rawSnapshot-DOKg5unn.js';
3
- import { S as SnapshotEnvironment } from './environment-Ddx0EDtY.js';
1
+ import { S as SnapshotStateOptions, a as SnapshotMatchOptions, b as SnapshotResult, R as RawSnapshotInfo } from './rawSnapshot.d-lFsMJFUd.js';
2
+ export { c as SnapshotData, d as SnapshotSerializer, e as SnapshotSummary, f as SnapshotUpdateState, U as UncheckedSnapshot } from './rawSnapshot.d-lFsMJFUd.js';
3
+ import { S as SnapshotEnvironment, P as ParsedStack } from './environment.d-DHdQ1Csl.js';
4
4
  import { Plugin, Plugins } from '@vitest/pretty-format';
5
5
 
6
- interface ParsedStack {
7
- method: string;
8
- file: string;
9
- line: number;
10
- column: number;
11
- }
12
-
13
6
  /**
14
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */
7
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
19
12
 
20
- declare class DefaultMap<K, V> extends Map<K, V> {
21
- private defaultFn;
22
- constructor(defaultFn: (key: K) => V, entries?: Iterable<readonly [K, V]>);
23
- get(key: K): V;
13
+ declare class DefaultMap<
14
+ K,
15
+ V
16
+ > extends Map<K, V> {
17
+ private defaultFn;
18
+ constructor(defaultFn: (key: K) => V, entries?: Iterable<readonly [K, V]>);
19
+ get(key: K): V;
24
20
  }
25
21
  declare class CounterMap<K> extends DefaultMap<K, number> {
26
- constructor();
27
- _total: number | undefined;
28
- valueOf(): number;
29
- increment(key: K): void;
30
- total(): number;
22
+ constructor();
23
+ _total: number | undefined;
24
+ valueOf(): number;
25
+ increment(key: K): void;
26
+ total(): number;
31
27
  }
32
28
 
33
- /**
34
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
35
- *
36
- * This source code is licensed under the MIT license found in the
37
- * LICENSE file in the root directory of this source tree.
38
- */
39
-
40
29
  interface SnapshotReturnOptions {
41
- actual: string;
42
- count: number;
43
- expected?: string;
44
- key: string;
45
- pass: boolean;
30
+ actual: string;
31
+ count: number;
32
+ expected?: string;
33
+ key: string;
34
+ pass: boolean;
46
35
  }
47
36
  interface SaveStatus {
48
- deleted: boolean;
49
- saved: boolean;
37
+ deleted: boolean;
38
+ saved: boolean;
50
39
  }
51
40
  declare class SnapshotState {
52
- testFilePath: string;
53
- snapshotPath: string;
54
- private _counters;
55
- private _dirty;
56
- private _updateSnapshot;
57
- private _snapshotData;
58
- private _initialData;
59
- private _inlineSnapshots;
60
- private _inlineSnapshotStacks;
61
- private _testIdToKeys;
62
- private _rawSnapshots;
63
- private _uncheckedKeys;
64
- private _snapshotFormat;
65
- private _environment;
66
- private _fileExists;
67
- expand: boolean;
68
- private _added;
69
- private _matched;
70
- private _unmatched;
71
- private _updated;
72
- get added(): CounterMap<string>;
73
- set added(value: number);
74
- get matched(): CounterMap<string>;
75
- set matched(value: number);
76
- get unmatched(): CounterMap<string>;
77
- set unmatched(value: number);
78
- get updated(): CounterMap<string>;
79
- set updated(value: number);
80
- private constructor();
81
- static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
82
- get environment(): SnapshotEnvironment;
83
- markSnapshotsAsCheckedForTest(testName: string): void;
84
- clearTest(testId: string): void;
85
- protected _inferInlineSnapshotStack(stacks: ParsedStack[]): ParsedStack | null;
86
- private _addSnapshot;
87
- save(): Promise<SaveStatus>;
88
- getUncheckedCount(): number;
89
- getUncheckedKeys(): Array<string>;
90
- removeUncheckedKeys(): void;
91
- match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot, }: SnapshotMatchOptions): SnapshotReturnOptions;
92
- pack(): Promise<SnapshotResult>;
41
+ testFilePath: string;
42
+ snapshotPath: string;
43
+ private _counters;
44
+ private _dirty;
45
+ private _updateSnapshot;
46
+ private _snapshotData;
47
+ private _initialData;
48
+ private _inlineSnapshots;
49
+ private _inlineSnapshotStacks;
50
+ private _testIdToKeys;
51
+ private _rawSnapshots;
52
+ private _uncheckedKeys;
53
+ private _snapshotFormat;
54
+ private _environment;
55
+ private _fileExists;
56
+ expand: boolean;
57
+ private _added;
58
+ private _matched;
59
+ private _unmatched;
60
+ private _updated;
61
+ get added(): CounterMap<string>;
62
+ set added(value: number);
63
+ get matched(): CounterMap<string>;
64
+ set matched(value: number);
65
+ get unmatched(): CounterMap<string>;
66
+ set unmatched(value: number);
67
+ get updated(): CounterMap<string>;
68
+ set updated(value: number);
69
+ private constructor();
70
+ static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
71
+ get environment(): SnapshotEnvironment;
72
+ markSnapshotsAsCheckedForTest(testName: string): void;
73
+ clearTest(testId: string): void;
74
+ protected _inferInlineSnapshotStack(stacks: ParsedStack[]): ParsedStack | null;
75
+ private _addSnapshot;
76
+ save(): Promise<SaveStatus>;
77
+ getUncheckedCount(): number;
78
+ getUncheckedKeys(): Array<string>;
79
+ removeUncheckedKeys(): void;
80
+ match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot }: SnapshotMatchOptions): SnapshotReturnOptions;
81
+ pack(): Promise<SnapshotResult>;
93
82
  }
94
83
 
95
84
  interface AssertOptions {
96
- received: unknown;
97
- filepath: string;
98
- name: string;
99
- /**
100
- * Not required but needed for `SnapshotClient.clearTest` to implement test-retry behavior.
101
- * @default name
102
- */
103
- testId?: string;
104
- message?: string;
105
- isInline?: boolean;
106
- properties?: object;
107
- inlineSnapshot?: string;
108
- error?: Error;
109
- errorMessage?: string;
110
- rawSnapshot?: RawSnapshotInfo;
85
+ received: unknown;
86
+ filepath: string;
87
+ name: string;
88
+ /**
89
+ * Not required but needed for `SnapshotClient.clearTest` to implement test-retry behavior.
90
+ * @default name
91
+ */
92
+ testId?: string;
93
+ message?: string;
94
+ isInline?: boolean;
95
+ properties?: object;
96
+ inlineSnapshot?: string;
97
+ error?: Error;
98
+ errorMessage?: string;
99
+ rawSnapshot?: RawSnapshotInfo;
111
100
  }
112
101
  interface SnapshotClientOptions {
113
- isEqual?: (received: unknown, expected: unknown) => boolean;
102
+ isEqual?: (received: unknown, expected: unknown) => boolean;
114
103
  }
115
104
  declare class SnapshotClient {
116
- private options;
117
- snapshotStateMap: Map<string, SnapshotState>;
118
- constructor(options?: SnapshotClientOptions);
119
- setup(filepath: string, options: SnapshotStateOptions): Promise<void>;
120
- finish(filepath: string): Promise<SnapshotResult>;
121
- skipTest(filepath: string, testName: string): void;
122
- clearTest(filepath: string, testId: string): void;
123
- getSnapshotState(filepath: string): SnapshotState;
124
- assert(options: AssertOptions): void;
125
- assertRaw(options: AssertOptions): Promise<void>;
126
- clear(): void;
105
+ private options;
106
+ snapshotStateMap: Map<string, SnapshotState>;
107
+ constructor(options?: SnapshotClientOptions);
108
+ setup(filepath: string, options: SnapshotStateOptions): Promise<void>;
109
+ finish(filepath: string): Promise<SnapshotResult>;
110
+ skipTest(filepath: string, testName: string): void;
111
+ clearTest(filepath: string, testId: string): void;
112
+ getSnapshotState(filepath: string): SnapshotState;
113
+ assert(options: AssertOptions): void;
114
+ assertRaw(options: AssertOptions): Promise<void>;
115
+ clear(): void;
127
116
  }
128
117
 
129
118
  declare function stripSnapshotIndentation(inlineSnapshot: string): string;
130
119
 
131
120
  /**
132
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
133
- *
134
- * This source code is licensed under the MIT license found in the
135
- * LICENSE file in the root directory of this source tree.
136
- */
121
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
122
+ *
123
+ * This source code is licensed under the MIT license found in the
124
+ * LICENSE file in the root directory of this source tree.
125
+ */
137
126
 
138
127
  declare function addSerializer(plugin: Plugin): void;
139
128
  declare function getSerializers(): Plugins;
package/dist/index.js CHANGED
@@ -657,7 +657,9 @@ function extractLocation(urlLike) {
657
657
  }
658
658
  if (url.startsWith("http:") || url.startsWith("https:")) {
659
659
  const urlObj = new URL(url);
660
- url = urlObj.pathname;
660
+ urlObj.searchParams.delete("import");
661
+ urlObj.searchParams.delete("browserv");
662
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
661
663
  }
662
664
  if (url.startsWith("/@fs/")) {
663
665
  const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
@@ -733,28 +735,40 @@ function parseSingleV8Stack(raw) {
733
735
  }
734
736
  function parseStacktrace(stack, options = {}) {
735
737
  const { ignoreStackEntries = stackIgnorePatterns } = options;
736
- let stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
737
- if (ignoreStackEntries.length) {
738
- stacks = stacks.filter(
739
- (stack2) => !ignoreStackEntries.some((p) => stack2.file.match(p))
740
- );
741
- }
738
+ const stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
742
739
  return stacks.map((stack2) => {
743
740
  var _a;
744
- if (options.getFileName) {
745
- stack2.file = options.getFileName(stack2.file);
741
+ if (options.getUrlId) {
742
+ stack2.file = options.getUrlId(stack2.file);
746
743
  }
747
744
  const map = (_a = options.getSourceMap) == null ? void 0 : _a.call(options, stack2.file);
748
745
  if (!map || typeof map !== "object" || !map.version) {
749
- return stack2;
746
+ return shouldFilter(ignoreStackEntries, stack2.file) ? null : stack2;
750
747
  }
751
748
  const traceMap = new TraceMap(map);
752
- const { line, column } = originalPositionFor(traceMap, stack2);
749
+ const { line, column, source, name } = originalPositionFor(traceMap, stack2);
750
+ let file = stack2.file;
751
+ if (source) {
752
+ const fileUrl = stack2.file.startsWith("file://") ? stack2.file : `file://${stack2.file}`;
753
+ const sourceRootUrl = map.sourceRoot ? new URL(map.sourceRoot, fileUrl) : fileUrl;
754
+ file = new URL(source, sourceRootUrl).pathname;
755
+ }
756
+ if (shouldFilter(ignoreStackEntries, file)) {
757
+ return null;
758
+ }
753
759
  if (line != null && column != null) {
754
- return { ...stack2, line, column };
760
+ return {
761
+ line,
762
+ column,
763
+ file,
764
+ method: name || stack2.method
765
+ };
755
766
  }
756
767
  return stack2;
757
- });
768
+ }).filter((s) => s != null);
769
+ }
770
+ function shouldFilter(ignoreStackEntries, file) {
771
+ return ignoreStackEntries.some((p) => file.match(p));
758
772
  }
759
773
  function parseFFOrSafariStackTrace(stack) {
760
774
  return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish);
@@ -1834,6 +1848,9 @@ class CounterMap extends DefaultMap {
1834
1848
  }
1835
1849
  }
1836
1850
 
1851
+ function isSameStackPosition(x, y) {
1852
+ return x.file === y.file && x.column === y.column && x.line === y.line;
1853
+ }
1837
1854
  class SnapshotState {
1838
1855
  constructor(testFilePath, snapshotPath, snapshotContent, options) {
1839
1856
  this.testFilePath = testFilePath;
@@ -2068,11 +2085,23 @@ ${JSON.stringify(
2068
2085
  }
2069
2086
  stack = ((_b = (_a = this.environment).processStackTrace) == null ? void 0 : _b.call(_a, _stack)) || _stack;
2070
2087
  stack.column--;
2071
- if (this._inlineSnapshotStacks.some((s) => s.file === stack.file && s.line === stack.line && s.column === stack.column)) {
2072
- this._inlineSnapshots = this._inlineSnapshots.filter((s) => !(s.file === stack.file && s.line === stack.line && s.column === stack.column));
2073
- throw new Error("toMatchInlineSnapshot cannot be called multiple times at the same location.");
2088
+ const snapshotsWithSameStack = this._inlineSnapshotStacks.filter((s) => isSameStackPosition(s, stack));
2089
+ if (snapshotsWithSameStack.length > 0) {
2090
+ this._inlineSnapshots = this._inlineSnapshots.filter((s) => !isSameStackPosition(s, stack));
2091
+ const differentSnapshot = snapshotsWithSameStack.find((s) => s.snapshot !== receivedSerialized);
2092
+ if (differentSnapshot) {
2093
+ throw Object.assign(
2094
+ new Error(
2095
+ "toMatchInlineSnapshot with different snapshots cannot be called at the same location"
2096
+ ),
2097
+ {
2098
+ actual: receivedSerialized,
2099
+ expected: differentSnapshot.snapshot
2100
+ }
2101
+ );
2102
+ }
2074
2103
  }
2075
- this._inlineSnapshotStacks.push({ ...stack, testId });
2104
+ this._inlineSnapshotStacks.push({ ...stack, testId, snapshot: receivedSerialized });
2076
2105
  }
2077
2106
  if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
2078
2107
  if (this._updateSnapshot === "all") {
package/dist/manager.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { S as SnapshotStateOptions, e as SnapshotSummary, b as SnapshotResult } from './rawSnapshot-DOKg5unn.js';
1
+ import { S as SnapshotStateOptions, e as SnapshotSummary, b as SnapshotResult } from './rawSnapshot.d-lFsMJFUd.js';
2
2
  import '@vitest/pretty-format';
3
- import './environment-Ddx0EDtY.js';
3
+ import './environment.d-DHdQ1Csl.js';
4
4
 
5
5
  declare class SnapshotManager {
6
- options: Omit<SnapshotStateOptions, 'snapshotEnvironment'>;
7
- summary: SnapshotSummary;
8
- extension: string;
9
- constructor(options: Omit<SnapshotStateOptions, 'snapshotEnvironment'>);
10
- clear(): void;
11
- add(result: SnapshotResult): void;
12
- resolvePath<T = any>(testPath: string, context?: T): string;
13
- resolveRawPath(testPath: string, rawPath: string): string;
6
+ options: Omit<SnapshotStateOptions, "snapshotEnvironment">;
7
+ summary: SnapshotSummary;
8
+ extension: string;
9
+ constructor(options: Omit<SnapshotStateOptions, "snapshotEnvironment">);
10
+ clear(): void;
11
+ add(result: SnapshotResult): void;
12
+ resolvePath<T = any>(testPath: string, context?: T): string;
13
+ resolveRawPath(testPath: string, rawPath: string): string;
14
14
  }
15
- declare function emptySummary(options: Omit<SnapshotStateOptions, 'snapshotEnvironment'>): SnapshotSummary;
15
+ declare function emptySummary(options: Omit<SnapshotStateOptions, "snapshotEnvironment">): SnapshotSummary;
16
16
  declare function addSnapshotResult(summary: SnapshotSummary, result: SnapshotResult): void;
17
17
 
18
18
  export { SnapshotManager, addSnapshotResult, emptySummary };
@@ -0,0 +1,61 @@
1
+ import { OptionsReceived, Plugin } from '@vitest/pretty-format';
2
+ import { S as SnapshotEnvironment } from './environment.d-DHdQ1Csl.js';
3
+
4
+ type SnapshotData = Record<string, string>;
5
+ type SnapshotUpdateState = "all" | "new" | "none";
6
+ type SnapshotSerializer = Plugin;
7
+ interface SnapshotStateOptions {
8
+ updateSnapshot: SnapshotUpdateState;
9
+ snapshotEnvironment: SnapshotEnvironment;
10
+ expand?: boolean;
11
+ snapshotFormat?: OptionsReceived;
12
+ resolveSnapshotPath?: (path: string, extension: string, context?: any) => string;
13
+ }
14
+ interface SnapshotMatchOptions {
15
+ testId: string;
16
+ testName: string;
17
+ received: unknown;
18
+ key?: string;
19
+ inlineSnapshot?: string;
20
+ isInline: boolean;
21
+ error?: Error;
22
+ rawSnapshot?: RawSnapshotInfo;
23
+ }
24
+ interface SnapshotResult {
25
+ filepath: string;
26
+ added: number;
27
+ fileDeleted: boolean;
28
+ matched: number;
29
+ unchecked: number;
30
+ uncheckedKeys: Array<string>;
31
+ unmatched: number;
32
+ updated: number;
33
+ }
34
+ interface UncheckedSnapshot {
35
+ filePath: string;
36
+ keys: Array<string>;
37
+ }
38
+ interface SnapshotSummary {
39
+ added: number;
40
+ didUpdate: boolean;
41
+ failure: boolean;
42
+ filesAdded: number;
43
+ filesRemoved: number;
44
+ filesRemovedList: Array<string>;
45
+ filesUnmatched: number;
46
+ filesUpdated: number;
47
+ matched: number;
48
+ total: number;
49
+ unchecked: number;
50
+ uncheckedKeysByFile: Array<UncheckedSnapshot>;
51
+ unmatched: number;
52
+ updated: number;
53
+ }
54
+
55
+ interface RawSnapshotInfo {
56
+ file: string;
57
+ readonly?: boolean;
58
+ content?: string;
59
+ }
60
+
61
+ export type { RawSnapshotInfo as R, SnapshotStateOptions as S, UncheckedSnapshot as U, SnapshotMatchOptions as a, SnapshotResult as b, SnapshotData as c, SnapshotSerializer as d, SnapshotSummary as e, SnapshotUpdateState as f };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/snapshot",
3
3
  "type": "module",
4
- "version": "3.0.7",
4
+ "version": "3.0.9",
5
5
  "description": "Vitest snapshot manager",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -40,12 +40,12 @@
40
40
  "dependencies": {
41
41
  "magic-string": "^0.30.17",
42
42
  "pathe": "^2.0.3",
43
- "@vitest/pretty-format": "3.0.7"
43
+ "@vitest/pretty-format": "3.0.9"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/natural-compare": "^1.4.3",
47
47
  "natural-compare": "^1.4.0",
48
- "@vitest/utils": "3.0.7"
48
+ "@vitest/utils": "3.0.9"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "rimraf dist && rollup -c",
@@ -1,22 +0,0 @@
1
- interface ParsedStack {
2
- method: string;
3
- file: string;
4
- line: number;
5
- column: number;
6
- }
7
-
8
- interface SnapshotEnvironment {
9
- getVersion: () => string;
10
- getHeader: () => string;
11
- resolvePath: (filepath: string) => Promise<string>;
12
- resolveRawPath: (testPath: string, rawPath: string) => Promise<string>;
13
- saveSnapshotFile: (filepath: string, snapshot: string) => Promise<void>;
14
- readSnapshotFile: (filepath: string) => Promise<string | null>;
15
- removeSnapshotFile: (filepath: string) => Promise<void>;
16
- processStackTrace?: (stack: ParsedStack) => ParsedStack;
17
- }
18
- interface SnapshotEnvironmentOptions {
19
- snapshotsDirName?: string;
20
- }
21
-
22
- export type { SnapshotEnvironment as S, SnapshotEnvironmentOptions as a };
@@ -1,61 +0,0 @@
1
- import { OptionsReceived, Plugin } from '@vitest/pretty-format';
2
- import { S as SnapshotEnvironment } from './environment-Ddx0EDtY.js';
3
-
4
- type SnapshotData = Record<string, string>;
5
- type SnapshotUpdateState = 'all' | 'new' | 'none';
6
- type SnapshotSerializer = Plugin;
7
- interface SnapshotStateOptions {
8
- updateSnapshot: SnapshotUpdateState;
9
- snapshotEnvironment: SnapshotEnvironment;
10
- expand?: boolean;
11
- snapshotFormat?: OptionsReceived;
12
- resolveSnapshotPath?: (path: string, extension: string, context?: any) => string;
13
- }
14
- interface SnapshotMatchOptions {
15
- testId: string;
16
- testName: string;
17
- received: unknown;
18
- key?: string;
19
- inlineSnapshot?: string;
20
- isInline: boolean;
21
- error?: Error;
22
- rawSnapshot?: RawSnapshotInfo;
23
- }
24
- interface SnapshotResult {
25
- filepath: string;
26
- added: number;
27
- fileDeleted: boolean;
28
- matched: number;
29
- unchecked: number;
30
- uncheckedKeys: Array<string>;
31
- unmatched: number;
32
- updated: number;
33
- }
34
- interface UncheckedSnapshot {
35
- filePath: string;
36
- keys: Array<string>;
37
- }
38
- interface SnapshotSummary {
39
- added: number;
40
- didUpdate: boolean;
41
- failure: boolean;
42
- filesAdded: number;
43
- filesRemoved: number;
44
- filesRemovedList: Array<string>;
45
- filesUnmatched: number;
46
- filesUpdated: number;
47
- matched: number;
48
- total: number;
49
- unchecked: number;
50
- uncheckedKeysByFile: Array<UncheckedSnapshot>;
51
- unmatched: number;
52
- updated: number;
53
- }
54
-
55
- interface RawSnapshotInfo {
56
- file: string;
57
- readonly?: boolean;
58
- content?: string;
59
- }
60
-
61
- export type { RawSnapshotInfo as R, SnapshotStateOptions as S, UncheckedSnapshot as U, SnapshotMatchOptions as a, SnapshotResult as b, SnapshotData as c, SnapshotSerializer as d, SnapshotSummary as e, SnapshotUpdateState as f };