@vitest/snapshot 2.1.5 → 2.2.0-beta.2
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
@@ -1,5 +1,5 @@
|
|
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-
|
1
|
+
import { S as SnapshotStateOptions, a as SnapshotMatchOptions, b as SnapshotResult, R as RawSnapshotInfo } from './rawSnapshot-CGKRMgF8.js';
|
2
|
+
export { c as SnapshotData, d as SnapshotSerializer, e as SnapshotSummary, f as SnapshotUpdateState, U as UncheckedSnapshot } from './rawSnapshot-CGKRMgF8.js';
|
3
3
|
import { S as SnapshotEnvironment } from './environment-Ddx0EDtY.js';
|
4
4
|
import { Plugin, Plugins } from '@vitest/pretty-format';
|
5
5
|
|
package/dist/manager.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
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-CGKRMgF8.js';
|
2
2
|
import '@vitest/pretty-format';
|
3
3
|
import './environment-Ddx0EDtY.js';
|
4
4
|
|
@@ -9,7 +9,7 @@ declare class SnapshotManager {
|
|
9
9
|
constructor(options: Omit<SnapshotStateOptions, 'snapshotEnvironment'>);
|
10
10
|
clear(): void;
|
11
11
|
add(result: SnapshotResult): void;
|
12
|
-
resolvePath(testPath: string): string;
|
12
|
+
resolvePath<T = any>(testPath: string, context?: T): string;
|
13
13
|
resolveRawPath(testPath: string, rawPath: string): string;
|
14
14
|
}
|
15
15
|
declare function emptySummary(options: Omit<SnapshotStateOptions, 'snapshotEnvironment'>): SnapshotSummary;
|
package/dist/manager.js
CHANGED
@@ -13,14 +13,14 @@ class SnapshotManager {
|
|
13
13
|
add(result) {
|
14
14
|
addSnapshotResult(this.summary, result);
|
15
15
|
}
|
16
|
-
resolvePath(testPath) {
|
16
|
+
resolvePath(testPath, context) {
|
17
17
|
const resolver = this.options.resolveSnapshotPath || (() => {
|
18
18
|
return join(
|
19
19
|
join(dirname(testPath), "__snapshots__"),
|
20
20
|
`${basename(testPath)}${this.extension}`
|
21
21
|
);
|
22
22
|
});
|
23
|
-
const path = resolver(testPath, this.extension);
|
23
|
+
const path = resolver(testPath, this.extension, context);
|
24
24
|
return path;
|
25
25
|
}
|
26
26
|
resolveRawPath(testPath, rawPath) {
|
@@ -9,7 +9,7 @@ interface SnapshotStateOptions {
|
|
9
9
|
snapshotEnvironment: SnapshotEnvironment;
|
10
10
|
expand?: boolean;
|
11
11
|
snapshotFormat?: OptionsReceived;
|
12
|
-
resolveSnapshotPath?: (path: string, extension: string) => string;
|
12
|
+
resolveSnapshotPath?: (path: string, extension: string, context?: any) => string;
|
13
13
|
}
|
14
14
|
interface SnapshotMatchOptions {
|
15
15
|
testName: string;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/snapshot",
|
3
3
|
"type": "module",
|
4
|
-
"version": "2.
|
4
|
+
"version": "2.2.0-beta.2",
|
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.12",
|
42
42
|
"pathe": "^1.1.2",
|
43
|
-
"@vitest/pretty-format": "2.
|
43
|
+
"@vitest/pretty-format": "2.2.0-beta.2"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@types/natural-compare": "^1.4.3",
|
47
47
|
"natural-compare": "^1.4.0",
|
48
|
-
"@vitest/utils": "2.
|
48
|
+
"@vitest/utils": "2.2.0-beta.2"
|
49
49
|
},
|
50
50
|
"scripts": {
|
51
51
|
"build": "rimraf dist && rollup -c",
|