@jsenv/snapshot 2.8.0 → 2.8.1
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.8.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Snapshot testing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@jsenv/assert": "4.1.14",
|
|
37
|
-
"@jsenv/ast": "6.2.
|
|
37
|
+
"@jsenv/ast": "6.2.14",
|
|
38
38
|
"@jsenv/exception": "1.0.1",
|
|
39
39
|
"@jsenv/filesystem": "4.9.9",
|
|
40
40
|
"@jsenv/terminal-recorder": "1.4.3",
|
|
@@ -58,6 +58,7 @@ export const createWellKnown = (name, replacement = name) => {
|
|
|
58
58
|
|
|
59
59
|
export const createReplaceFilesystemWellKnownValues = ({
|
|
60
60
|
rootDirectoryUrl,
|
|
61
|
+
localhostUrl,
|
|
61
62
|
// for unit tests
|
|
62
63
|
isWindows = process.platform === "win32",
|
|
63
64
|
ancestorPackagesDisabled,
|
|
@@ -126,9 +127,32 @@ export const createReplaceFilesystemWellKnownValues = ({
|
|
|
126
127
|
}
|
|
127
128
|
};
|
|
128
129
|
};
|
|
130
|
+
const addWellKnownUrl = (url, replacement) => {
|
|
131
|
+
const wellKnownUrl = {
|
|
132
|
+
url,
|
|
133
|
+
replace: (string) => {
|
|
134
|
+
return string.replaceAll(url, replacement);
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
wellKownUrlArray.push(wellKnownUrl);
|
|
138
|
+
return () => {
|
|
139
|
+
const urlIndex = wellKownUrlArray.indexOf(wellKnownUrl);
|
|
140
|
+
if (urlIndex > -1) {
|
|
141
|
+
wellKownUrlArray.splice(urlIndex, 1);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
};
|
|
129
145
|
if (rootDirectoryUrl) {
|
|
130
146
|
addWellKnownFileUrl(rootDirectoryUrl, WELL_KNOWN_ROOT);
|
|
131
147
|
}
|
|
148
|
+
if (localhostUrl) {
|
|
149
|
+
addWellKnownUrl(
|
|
150
|
+
localhostUrl,
|
|
151
|
+
localhostUrl.startsWith("https")
|
|
152
|
+
? "https://localhost"
|
|
153
|
+
: "http://localhost",
|
|
154
|
+
);
|
|
155
|
+
}
|
|
132
156
|
/*
|
|
133
157
|
* When running code inside a node project ancestor packages
|
|
134
158
|
* should make things super predictible because
|
|
@@ -21,11 +21,13 @@ export const replaceFluctuatingValues = (
|
|
|
21
21
|
{
|
|
22
22
|
stringType,
|
|
23
23
|
rootDirectoryUrl,
|
|
24
|
+
localhostUrl,
|
|
24
25
|
fileUrl,
|
|
25
26
|
preserveAnsi,
|
|
26
27
|
// for unit test
|
|
27
28
|
replaceFilesystemWellKnownValues = createReplaceFilesystemWellKnownValues({
|
|
28
29
|
rootDirectoryUrl,
|
|
30
|
+
localhostUrl,
|
|
29
31
|
}),
|
|
30
32
|
} = {},
|
|
31
33
|
) => {
|