@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.
- package/dist/environment.d-DHdQ1Csl.d.ts +22 -0
- package/dist/environment.d.ts +11 -11
- package/dist/index.d.ts +100 -111
- package/dist/index.js +46 -17
- package/dist/manager.d.ts +11 -11
- package/dist/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
- package/package.json +3 -3
- package/dist/environment-Ddx0EDtY.d.ts +0 -22
- package/dist/rawSnapshot-DOKg5unn.d.ts +0 -61
@@ -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 };
|
package/dist/environment.d.ts
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
import { S as SnapshotEnvironment, a as SnapshotEnvironmentOptions } from './environment-
|
1
|
+
import { S as SnapshotEnvironment, a as SnapshotEnvironmentOptions } from './environment.d-DHdQ1Csl.js';
|
2
2
|
|
3
3
|
declare class NodeSnapshotEnvironment implements SnapshotEnvironment {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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-
|
2
|
-
export { c as SnapshotData, d as SnapshotSerializer, e as SnapshotSummary, f as SnapshotUpdateState, U as UncheckedSnapshot } from './rawSnapshot-
|
3
|
-
import { S as SnapshotEnvironment } from './environment-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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<
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
30
|
+
actual: string;
|
31
|
+
count: number;
|
32
|
+
expected?: string;
|
33
|
+
key: string;
|
34
|
+
pass: boolean;
|
46
35
|
}
|
47
36
|
interface SaveStatus {
|
48
|
-
|
49
|
-
|
37
|
+
deleted: boolean;
|
38
|
+
saved: boolean;
|
50
39
|
}
|
51
40
|
declare class SnapshotState {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
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
|
-
|
102
|
+
isEqual?: (received: unknown, expected: unknown) => boolean;
|
114
103
|
}
|
115
104
|
declare class SnapshotClient {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
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
|
-
|
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
|
-
|
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.
|
745
|
-
stack2.file = options.
|
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 {
|
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
|
-
|
2072
|
-
|
2073
|
-
|
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-
|
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-
|
3
|
+
import './environment.d-DHdQ1Csl.js';
|
4
4
|
|
5
5
|
declare class SnapshotManager {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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,
|
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.
|
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.
|
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.
|
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 };
|