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