@jsenv/snapshot 2.8.1 → 2.8.3
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.3",
|
|
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.1.
|
|
36
|
+
"@jsenv/assert": "4.1.15",
|
|
37
37
|
"@jsenv/ast": "6.2.14",
|
|
38
38
|
"@jsenv/exception": "1.0.1",
|
|
39
39
|
"@jsenv/filesystem": "4.9.9",
|
|
@@ -53,27 +53,31 @@ export const spyFilesystemCalls = (
|
|
|
53
53
|
: stateBefore.mtimeMs === stateAfter.mtimeMs
|
|
54
54
|
? ""
|
|
55
55
|
: "mtime_modified";
|
|
56
|
-
if (reason) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
if (!reason) {
|
|
57
|
+
// file is exactly the same
|
|
58
|
+
// function did not have any effect on the file
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!shouldReport(fileUrl)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (undoFilesystemSideEffects && !fileRestoreMap.has(fileUrl)) {
|
|
65
|
+
if (stateBefore.found) {
|
|
66
|
+
fileRestoreMap.set(fileUrl, () => {
|
|
67
|
+
writeFileSync(fileUrl, stateBefore.buffer);
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
fileRestoreMap.set(fileUrl, () => {
|
|
71
|
+
removeFileSync(fileUrl, { allowUseless: true });
|
|
72
|
+
});
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
|
-
|
|
74
|
-
// function did not have any effect on the file
|
|
75
|
+
onWriteFile(fileUrl, stateAfter.buffer, reason);
|
|
75
76
|
};
|
|
76
77
|
const onWriteDirectoryDone = (directoryUrl) => {
|
|
78
|
+
if (!shouldReport(directoryUrl)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
77
81
|
if (undoFilesystemSideEffects && !fileRestoreMap.has(directoryUrl)) {
|
|
78
82
|
fileRestoreMap.set(directoryUrl, () => {
|
|
79
83
|
removeDirectorySync(directoryUrl, {
|
|
@@ -82,9 +86,7 @@ export const spyFilesystemCalls = (
|
|
|
82
86
|
});
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
|
-
|
|
86
|
-
onWriteDirectory(directoryUrl);
|
|
87
|
-
}
|
|
89
|
+
onWriteDirectory(directoryUrl);
|
|
88
90
|
};
|
|
89
91
|
const restoreCallbackSet = new Set();
|
|
90
92
|
|