@vitest/snapshot 3.0.0-beta.2 → 3.0.0-beta.4
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.js +7 -7
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -1865,7 +1865,7 @@ class SnapshotState {
|
|
1865
1865
|
}
|
1866
1866
|
markSnapshotsAsCheckedForTest(testName) {
|
1867
1867
|
this._uncheckedKeys.forEach((uncheckedKey) => {
|
1868
|
-
if (
|
1868
|
+
if (/ \d+$| > /.test(uncheckedKey.slice(testName.length))) {
|
1869
1869
|
this._uncheckedKeys.delete(uncheckedKey);
|
1870
1870
|
}
|
1871
1871
|
});
|
@@ -1995,8 +1995,8 @@ class SnapshotState {
|
|
1995
1995
|
}
|
1996
1996
|
}
|
1997
1997
|
const expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key];
|
1998
|
-
const expectedTrimmed = prepareExpected(expected);
|
1999
|
-
const pass = expectedTrimmed === prepareExpected(receivedSerialized);
|
1998
|
+
const expectedTrimmed = rawSnapshot ? expected : prepareExpected(expected);
|
1999
|
+
const pass = expectedTrimmed === (rawSnapshot ? receivedSerialized : prepareExpected(receivedSerialized));
|
2000
2000
|
const hasSnapshot = expected !== void 0;
|
2001
2001
|
const snapshotIsPersisted = isInline || this._fileExists || rawSnapshot && rawSnapshot.content != null;
|
2002
2002
|
if (pass && !isInline && !rawSnapshot) {
|
@@ -2060,9 +2060,9 @@ ${JSON.stringify(
|
|
2060
2060
|
if (!pass) {
|
2061
2061
|
this.unmatched.increment(testId);
|
2062
2062
|
return {
|
2063
|
-
actual: removeExtraLineBreaks(receivedSerialized),
|
2063
|
+
actual: rawSnapshot ? receivedSerialized : removeExtraLineBreaks(receivedSerialized),
|
2064
2064
|
count,
|
2065
|
-
expected: expectedTrimmed !== void 0 ? removeExtraLineBreaks(expectedTrimmed) : void 0,
|
2065
|
+
expected: expectedTrimmed !== void 0 ? rawSnapshot ? expectedTrimmed : removeExtraLineBreaks(expectedTrimmed) : void 0,
|
2066
2066
|
key,
|
2067
2067
|
pass: false
|
2068
2068
|
};
|
@@ -2216,8 +2216,8 @@ class SnapshotClient {
|
|
2216
2216
|
throw createMismatchError(
|
2217
2217
|
`Snapshot \`${key || "unknown"}\` mismatched`,
|
2218
2218
|
snapshotState.expand,
|
2219
|
-
actual == null ? void 0 : actual.trim(),
|
2220
|
-
expected == null ? void 0 : expected.trim()
|
2219
|
+
rawSnapshot ? actual : actual == null ? void 0 : actual.trim(),
|
2220
|
+
rawSnapshot ? expected : expected == null ? void 0 : expected.trim()
|
2221
2221
|
);
|
2222
2222
|
}
|
2223
2223
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/snapshot",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.0-beta.
|
4
|
+
"version": "3.0.0-beta.4",
|
5
5
|
"description": "Vitest snapshot manager",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -38,14 +38,14 @@
|
|
38
38
|
"dist"
|
39
39
|
],
|
40
40
|
"dependencies": {
|
41
|
-
"magic-string": "^0.30.
|
42
|
-
"pathe": "^
|
43
|
-
"@vitest/pretty-format": "3.0.0-beta.
|
41
|
+
"magic-string": "^0.30.17",
|
42
|
+
"pathe": "^2.0.0",
|
43
|
+
"@vitest/pretty-format": "3.0.0-beta.4"
|
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.0-beta.
|
48
|
+
"@vitest/utils": "3.0.0-beta.4"
|
49
49
|
},
|
50
50
|
"scripts": {
|
51
51
|
"build": "rimraf dist && rollup -c",
|