filesystem-sandbox 1.28.0 → 1.29.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/dist/filesystem-sandbox.js +12 -1
- package/package.json +4 -2
|
@@ -34,6 +34,8 @@ const os = __importStar(require("os"));
|
|
|
34
34
|
const path_1 = __importDefault(require("path"));
|
|
35
35
|
const uuid_1 = require("./uuid");
|
|
36
36
|
const yafs_1 = require("yafs");
|
|
37
|
+
const debug_1 = require("debug");
|
|
38
|
+
const debug = (0, debug_1.debug)("yafs");
|
|
37
39
|
if (!fs_1.promises) {
|
|
38
40
|
throw new Error("Yer node is olde! filesystem-sandboxes requires a Node with fs.promises");
|
|
39
41
|
}
|
|
@@ -257,7 +259,16 @@ class Sandbox {
|
|
|
257
259
|
*/
|
|
258
260
|
static async destroyAny() {
|
|
259
261
|
const target = path_1.default.join(baseTarget, exports.basePrefix);
|
|
260
|
-
|
|
262
|
+
try {
|
|
263
|
+
await (0, yafs_1.rm)(target);
|
|
264
|
+
}
|
|
265
|
+
catch (e) {
|
|
266
|
+
if (e && e.code === "ENOEMPTY") {
|
|
267
|
+
debug(`Unable to remove all of ${target} - something is busy in there`);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
throw e;
|
|
271
|
+
}
|
|
261
272
|
}
|
|
262
273
|
static async create(at) {
|
|
263
274
|
return new Sandbox(at);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filesystem-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "JavaScript module to provide filesystem sandboxes for testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"homepage": "https://github.com/fluffynuts/filesystem-sandbox#readme",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@faker-js/faker": "^6.0.0",
|
|
42
|
+
"@types/debug": "^4.1.12",
|
|
42
43
|
"@types/jest": "^25.2.3",
|
|
43
44
|
"@types/lodash": "^4.14.153",
|
|
44
45
|
"@types/mkdirp": "^1.0.0",
|
|
@@ -52,10 +53,11 @@
|
|
|
52
53
|
"ts-jest": "^28.0.4",
|
|
53
54
|
"tslint": "^6.1.2",
|
|
54
55
|
"typescript": "^4.6.2",
|
|
55
|
-
"yafs": "^1.
|
|
56
|
+
"yafs": "^1.42.0",
|
|
56
57
|
"zarro": "^1.199.0"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
60
|
+
"debug": "^4.4.1",
|
|
59
61
|
"mkdirp": "^1.0.4",
|
|
60
62
|
"pure-uuid": "^1.6.2",
|
|
61
63
|
"rimraf": "^3.0.2"
|