@jsenv/snapshot 2.9.5 → 2.9.6
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.9.
|
|
3
|
+
"version": "2.9.6",
|
|
4
4
|
"description": "Snapshot testing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@jsenv/assert": "4.4.0",
|
|
37
37
|
"@jsenv/ast": "6.2.16",
|
|
38
38
|
"@jsenv/exception": "1.1.1",
|
|
39
|
+
"@jsenv/humanize": "1.2.8",
|
|
39
40
|
"@jsenv/filesystem": "4.10.0",
|
|
40
41
|
"@jsenv/terminal-recorder": "1.4.4",
|
|
41
42
|
"@jsenv/urls": "2.5.2",
|
|
@@ -68,6 +68,15 @@ export const replaceFluctuatingValues = (
|
|
|
68
68
|
// );
|
|
69
69
|
return string;
|
|
70
70
|
};
|
|
71
|
+
// const replaceUnicodeFallbacks = (string) => {
|
|
72
|
+
// string = string.replaceAll(">", "❯");
|
|
73
|
+
// string = string.replaceAll("√", "✔");
|
|
74
|
+
// string = string.replaceAll("×", "✖");
|
|
75
|
+
// string = string.replaceAll("♦", "◆");
|
|
76
|
+
// string = string.replaceAll("i", "ℹ");
|
|
77
|
+
// // string = string.replaceAll("‼", "⚠");
|
|
78
|
+
// return string;
|
|
79
|
+
// };
|
|
71
80
|
const replaceThings = (string, { shouldReplaceDurations } = {}) => {
|
|
72
81
|
if (stringType === "filesystem") {
|
|
73
82
|
return replaceFilesystemWellKnownValues(string);
|
|
@@ -82,6 +91,7 @@ export const replaceFluctuatingValues = (
|
|
|
82
91
|
if (shouldReplaceDurations !== false) {
|
|
83
92
|
string = replaceDurations(string);
|
|
84
93
|
}
|
|
94
|
+
// string = replaceUnicodeFallbacks(string);
|
|
85
95
|
string = replaceSizes(string);
|
|
86
96
|
return string;
|
|
87
97
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseFunction } from "@jsenv/assert/src/utils/function_parser.js";
|
|
2
|
+
import { ANSI, UNICODE } from "@jsenv/humanize";
|
|
2
3
|
import { createReplaceFilesystemWellKnownValues } from "../filesystem_well_known_values.js";
|
|
3
4
|
import { filesystemSideEffects } from "./filesystem/filesystem_side_effects.js";
|
|
4
5
|
import { logSideEffects } from "./log/log_side_effects.js";
|
|
@@ -37,6 +38,14 @@ export const createCaptureSideEffects = ({
|
|
|
37
38
|
};
|
|
38
39
|
let functionExecutingCount = 0;
|
|
39
40
|
const capture = (fn, { callSite, baseDirectory } = {}) => {
|
|
41
|
+
const unicodeSupported = UNICODE.supported;
|
|
42
|
+
const ansiSupported = ANSI.supported;
|
|
43
|
+
// this is fragile because if the copy of humanize we have
|
|
44
|
+
// is not the same (different version)
|
|
45
|
+
// we won't be able to force support
|
|
46
|
+
// good enough for now
|
|
47
|
+
UNICODE.supported = true;
|
|
48
|
+
ANSI.supported = true;
|
|
40
49
|
if (baseDirectory !== undefined && filesystemSideEffectsDetector) {
|
|
41
50
|
filesystemSideEffectsDetector.setBaseDirectory(baseDirectory);
|
|
42
51
|
}
|
|
@@ -265,6 +274,8 @@ export const createCaptureSideEffects = ({
|
|
|
265
274
|
};
|
|
266
275
|
const onFinally = () => {
|
|
267
276
|
delete process.env.CAPTURING_SIDE_EFFECTS;
|
|
277
|
+
UNICODE.supported = unicodeSupported;
|
|
278
|
+
ANSI.supported = ansiSupported;
|
|
268
279
|
functionExecutingCount--;
|
|
269
280
|
for (const finallyCallback of finallyCallbackSet) {
|
|
270
281
|
finallyCallback(sideEffects);
|