@vitest/snapshot 0.34.5 → 0.34.7
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 +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1024,11 +1024,10 @@ function prepareSnapString(snap, source, index) {
|
|
|
1024
1024
|
const indentNext = indent.includes(" ") ? `${indent} ` : `${indent} `;
|
|
1025
1025
|
const lines = snap.trim().replace(/\\/g, "\\\\").split(/\n/g);
|
|
1026
1026
|
const isOneline = lines.length <= 1;
|
|
1027
|
-
const quote =
|
|
1027
|
+
const quote = "`";
|
|
1028
1028
|
if (isOneline)
|
|
1029
|
-
return
|
|
1030
|
-
|
|
1031
|
-
return `${quote}
|
|
1029
|
+
return `${quote}${lines.join("\n").replace(/`/g, "\\`").replace(/\${/g, "\\${")}${quote}`;
|
|
1030
|
+
return `${quote}
|
|
1032
1031
|
${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\${/g, "\\${")}
|
|
1033
1032
|
${indent}${quote}`;
|
|
1034
1033
|
}
|
|
@@ -1112,6 +1111,7 @@ class SnapshotState {
|
|
|
1112
1111
|
this.updated = 0;
|
|
1113
1112
|
this._snapshotFormat = {
|
|
1114
1113
|
printBasicPrototype: false,
|
|
1114
|
+
escapeString: false,
|
|
1115
1115
|
...options.snapshotFormat
|
|
1116
1116
|
};
|
|
1117
1117
|
this._environment = options.snapshotEnvironment;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/snapshot",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.34.
|
|
4
|
+
"version": "0.34.7",
|
|
5
5
|
"description": "Vitest snapshot manager",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/natural-compare": "^1.4.1",
|
|
47
47
|
"natural-compare": "^1.4.0",
|
|
48
|
-
"@vitest/utils": "0.34.
|
|
48
|
+
"@vitest/utils": "0.34.7"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "rimraf dist && rollup -c",
|