@jsenv/snapshot 2.8.10 → 2.9.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/snapshot",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Snapshot testing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"test": "node --conditions=development ./scripts/test.mjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@jsenv/assert": "4.2.
|
|
36
|
+
"@jsenv/assert": "4.2.1",
|
|
37
37
|
"@jsenv/ast": "6.2.16",
|
|
38
38
|
"@jsenv/exception": "1.1.0",
|
|
39
39
|
"@jsenv/filesystem": "4.10.0",
|
|
@@ -8,6 +8,7 @@ export const createCaptureSideEffects = ({
|
|
|
8
8
|
logEffects = true,
|
|
9
9
|
filesystemEffects = true,
|
|
10
10
|
filesystemActions,
|
|
11
|
+
executionEffects = {},
|
|
11
12
|
rootDirectoryUrl,
|
|
12
13
|
replaceFilesystemWellKnownValues = createReplaceFilesystemWellKnownValues({
|
|
13
14
|
rootDirectoryUrl,
|
|
@@ -285,6 +286,12 @@ export const createCaptureSideEffects = ({
|
|
|
285
286
|
return sideEffects;
|
|
286
287
|
},
|
|
287
288
|
(e) => {
|
|
289
|
+
if (executionEffects.catch === false) {
|
|
290
|
+
throw e;
|
|
291
|
+
}
|
|
292
|
+
if (typeof executionEffects.catch === "function") {
|
|
293
|
+
executionEffects.catch(e);
|
|
294
|
+
}
|
|
288
295
|
onReject(e);
|
|
289
296
|
onFinally();
|
|
290
297
|
return sideEffects;
|
|
@@ -295,6 +302,12 @@ export const createCaptureSideEffects = ({
|
|
|
295
302
|
onReturn(valueReturned);
|
|
296
303
|
return sideEffects;
|
|
297
304
|
} catch (e) {
|
|
305
|
+
if (executionEffects.catch === false) {
|
|
306
|
+
throw e;
|
|
307
|
+
}
|
|
308
|
+
if (typeof executionEffects.catch === "function") {
|
|
309
|
+
executionEffects.catch(e);
|
|
310
|
+
}
|
|
298
311
|
onCatch(e);
|
|
299
312
|
return sideEffects;
|
|
300
313
|
} finally {
|
|
@@ -32,7 +32,6 @@ export const snapshotSideEffects = (
|
|
|
32
32
|
{
|
|
33
33
|
sideEffectMdFileUrl,
|
|
34
34
|
outFilePattern = "_[source_filename]/[filename]",
|
|
35
|
-
errorTransform,
|
|
36
35
|
throwWhenDiff,
|
|
37
36
|
...captureOptions
|
|
38
37
|
} = {},
|
|
@@ -64,7 +63,6 @@ export const snapshotSideEffects = (
|
|
|
64
63
|
title: urlToFilename(sourceFileUrl),
|
|
65
64
|
sideEffectMdFileUrl,
|
|
66
65
|
generateOutFileUrl,
|
|
67
|
-
errorTransform,
|
|
68
66
|
});
|
|
69
67
|
writeFileSync(sideEffectMdFileUrl, sideEffectFileContent);
|
|
70
68
|
outDirectorySnapshot.compare(throwWhenDiff);
|
|
@@ -37,7 +37,7 @@ export const snapshotTests = async (
|
|
|
37
37
|
},
|
|
38
38
|
rootDirectoryUrl,
|
|
39
39
|
generatedBy = true,
|
|
40
|
-
|
|
40
|
+
executionEffects,
|
|
41
41
|
logEffects,
|
|
42
42
|
filesystemEffects,
|
|
43
43
|
throwWhenDiff = process.env.CI,
|
|
@@ -94,6 +94,7 @@ export const snapshotTests = async (
|
|
|
94
94
|
const captureSideEffects = createCaptureSideEffects({
|
|
95
95
|
sourceFileUrl,
|
|
96
96
|
rootDirectoryUrl,
|
|
97
|
+
executionEffects,
|
|
97
98
|
logEffects,
|
|
98
99
|
filesystemEffects,
|
|
99
100
|
filesystemActions,
|
|
@@ -166,7 +167,6 @@ export const snapshotTests = async (
|
|
|
166
167
|
sideEffectMdFileUrl: scenarioMdFileUrl,
|
|
167
168
|
generateOutFileUrl: generateScenarioOutFileUrl,
|
|
168
169
|
title: scenario,
|
|
169
|
-
errorTransform,
|
|
170
170
|
});
|
|
171
171
|
writeFileSync(scenarioMdFileUrl, sideEffectsMarkdown);
|
|
172
172
|
}
|