filesystem-sandbox 1.31.0 → 1.32.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.
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
2
4
|
import { SpawnOptions } from "child_process";
|
|
3
5
|
import { StatsBase } from "fs";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
+
export type Func<T> = () => T;
|
|
7
|
+
export type AsyncFunc<T> = () => Promise<T>;
|
|
6
8
|
export declare const basePrefix = "__sandboxes__";
|
|
7
9
|
export declare class Sandbox {
|
|
8
10
|
private readonly _path;
|
|
@@ -70,6 +70,9 @@ async function writeData(fullPath, contents, writeFunction) {
|
|
|
70
70
|
return fullPath;
|
|
71
71
|
}
|
|
72
72
|
class Sandbox {
|
|
73
|
+
get path() {
|
|
74
|
+
return this._path;
|
|
75
|
+
}
|
|
73
76
|
constructor(at) {
|
|
74
77
|
this._at = at;
|
|
75
78
|
this._base = path_1.default.join(at || baseTarget, exports.basePrefix);
|
|
@@ -77,9 +80,6 @@ class Sandbox {
|
|
|
77
80
|
(0, yafs_1.mkdirSync)(this._path);
|
|
78
81
|
sandboxes.push(this);
|
|
79
82
|
}
|
|
80
|
-
get path() {
|
|
81
|
-
return this._path;
|
|
82
|
-
}
|
|
83
83
|
async destroy() {
|
|
84
84
|
try {
|
|
85
85
|
await this.tryDestroySelf();
|
|
@@ -224,7 +224,7 @@ class Sandbox {
|
|
|
224
224
|
result.stdout.push(d.toString());
|
|
225
225
|
});
|
|
226
226
|
child.on("close", code => {
|
|
227
|
-
result.code = code;
|
|
227
|
+
result.code = code !== null && code !== void 0 ? code : -1;
|
|
228
228
|
return code
|
|
229
229
|
? reject(makeSpawnErrorFor(result, command, args, options))
|
|
230
230
|
: resolve(result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filesystem-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.1",
|
|
4
4
|
"description": "JavaScript module to provide filesystem sandboxes for testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"pretest": "
|
|
13
|
+
"pretest": "npm run clear-jest-cache",
|
|
14
14
|
"test": "jest",
|
|
15
|
-
"posttest": "
|
|
15
|
+
"posttest": "npm run clear-jest-cache",
|
|
16
|
+
"clear-jest-cache": "node -e \"require('fs').rmSync('.jest-cache', { recursive: true, force: true })\"",
|
|
16
17
|
"prebuild": "run-p clean-dist generate-index",
|
|
17
|
-
"clean-dist": "
|
|
18
|
+
"clean-dist": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
18
19
|
"generate-index": "node generate-index.js",
|
|
19
20
|
"build": "run-p tsc lint",
|
|
20
21
|
"autobuild": "nodemon -V -w src -w tests -e ts -x \"run-s -s build autobuild-message\"",
|
|
@@ -41,28 +42,32 @@
|
|
|
41
42
|
},
|
|
42
43
|
"homepage": "https://github.com/fluffynuts/filesystem-sandbox#readme",
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@faker-js/faker": "^
|
|
45
|
+
"@faker-js/faker": "^10.5.0",
|
|
45
46
|
"@types/debug": "^4.1.12",
|
|
46
47
|
"@types/jest": "^25.2.3",
|
|
47
48
|
"@types/lodash": "^4.14.153",
|
|
48
|
-
"@types/mkdirp": "^1.0.0",
|
|
49
49
|
"@types/node": "^14.0.5",
|
|
50
50
|
"eslint": "^7.1.0",
|
|
51
51
|
"expect-even-more-jest": "^1.20.0",
|
|
52
52
|
"expect-more-jest": "^5.1.0",
|
|
53
53
|
"jest": "^28.1.1",
|
|
54
54
|
"lodash": "^4.17.15",
|
|
55
|
-
"nodemon": "^
|
|
55
|
+
"nodemon": "^3.1.14",
|
|
56
|
+
"npm-run-all2": "^9.1.0",
|
|
57
|
+
"semver": "^7.8.6",
|
|
56
58
|
"ts-jest": "^28.0.4",
|
|
57
59
|
"tslint": "^6.1.2",
|
|
58
60
|
"typescript": "^4.6.2",
|
|
59
|
-
"
|
|
60
|
-
"zarro": "^1.199.0"
|
|
61
|
+
"zarro": "^2.3.14"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
64
|
"debug": "^4.4.1",
|
|
64
|
-
"mkdirp": "^1.0.4",
|
|
65
65
|
"pure-uuid": "^1.6.2",
|
|
66
|
-
"
|
|
66
|
+
"yafs": "^1.48.0"
|
|
67
|
+
},
|
|
68
|
+
"overrides": {
|
|
69
|
+
"nodemon": {
|
|
70
|
+
"minimatch": "^11.0.8"
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
|
-
}
|
|
73
|
+
}
|