@jsenv/snapshot 2.16.2 → 2.16.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/snapshot",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.4",
|
|
4
4
|
"description": "Snapshot testing",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@jsenv/assert": "4.5.5",
|
|
29
|
-
"@jsenv/ast": "6.7.
|
|
29
|
+
"@jsenv/ast": "6.7.20",
|
|
30
30
|
"@jsenv/exception": "1.2.1",
|
|
31
|
-
"@jsenv/filesystem": "4.15.
|
|
32
|
-
"@jsenv/humanize": "1.7.
|
|
33
|
-
"@jsenv/terminal-recorder": "1.5.
|
|
31
|
+
"@jsenv/filesystem": "4.15.13",
|
|
32
|
+
"@jsenv/humanize": "1.7.5",
|
|
33
|
+
"@jsenv/terminal-recorder": "1.5.34",
|
|
34
34
|
"@jsenv/url-meta": "8.5.7",
|
|
35
|
-
"@jsenv/urls": "2.9.
|
|
35
|
+
"@jsenv/urls": "2.9.7",
|
|
36
36
|
"@jsenv/utils": "2.3.1",
|
|
37
37
|
"ansi-regex": "6.2.2",
|
|
38
38
|
"pixelmatch": "7.1.0",
|
|
39
39
|
"pngjs": "7.0.0",
|
|
40
|
-
"prettier": "3.
|
|
40
|
+
"prettier": "3.8.1",
|
|
41
41
|
"strip-ansi": "7.1.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -110,7 +110,10 @@ export const replaceFluctuatingValues = (
|
|
|
110
110
|
if (stringType === "json") {
|
|
111
111
|
const jsValue = JSON.parse(value);
|
|
112
112
|
const replaced = replaceInObject(jsValue, { replace: replaceThings });
|
|
113
|
-
return
|
|
113
|
+
return humanize(replaced, {
|
|
114
|
+
quote: `"`, // prefer double for json
|
|
115
|
+
indentSize: 2,
|
|
116
|
+
});
|
|
114
117
|
}
|
|
115
118
|
if (stringType === "html" || stringType === "xml") {
|
|
116
119
|
// do parse html
|
|
@@ -166,19 +169,14 @@ export const replaceFluctuatingValues = (
|
|
|
166
169
|
return regexpSource;
|
|
167
170
|
}
|
|
168
171
|
const jsValueReplaced = replaceInObject(value, { replace: replaceThings });
|
|
169
|
-
return
|
|
172
|
+
return humanize(jsValueReplaced, {
|
|
173
|
+
quote: "auto", // Let humanize decide the best quotes
|
|
174
|
+
indentSize: 2,
|
|
175
|
+
});
|
|
170
176
|
}
|
|
171
177
|
return value;
|
|
172
178
|
};
|
|
173
179
|
|
|
174
|
-
// Use humanize for better JavaScript value representation
|
|
175
|
-
const jsonStringifyWithUndefined = (obj) => {
|
|
176
|
-
return humanize(obj, {
|
|
177
|
-
quote: "auto", // Let humanize decide the best quotes
|
|
178
|
-
indentSize: 2,
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
|
|
182
180
|
const replaceInObject = (object, { replace }) => {
|
|
183
181
|
const deepCopy = (
|
|
184
182
|
value,
|
|
@@ -20,6 +20,8 @@ import { renderSideEffects, renderSmallLink } from "./render_side_effects.js";
|
|
|
20
20
|
* Any error thrown by test function is detected and added to side effects
|
|
21
21
|
* @param {boolean} [snapshotTestsOptions.executionEffects.return=true]
|
|
22
22
|
* Test function return value is added to side effects
|
|
23
|
+
* @param {Object} [snapshotTestsOptions.logEffects]
|
|
24
|
+
* Control how console outputs are captured and included in side effects
|
|
23
25
|
* @param {Object} [snapshotTestsOptions.filesystemActions]
|
|
24
26
|
* Control what to do when there is a file side effect
|
|
25
27
|
* "compare", "compare_presence_only", "undo", "ignore"
|