filesystem-sandbox 1.29.0 → 1.30.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.
|
@@ -28,17 +28,18 @@ export declare class Sandbox {
|
|
|
28
28
|
private runOnStat;
|
|
29
29
|
run<T>(fn: Func<T> | AsyncFunc<T>, relativePath?: string): Promise<T>;
|
|
30
30
|
exec(command: string, args?: string[], options?: SpawnOptions): Promise<ProcessData>;
|
|
31
|
+
touch(filePath: string): Promise<void>;
|
|
31
32
|
private _validatePathInsideSandbox;
|
|
32
33
|
/**
|
|
33
34
|
* Destroys all sandboxes created in this process up until now
|
|
34
35
|
*/
|
|
35
36
|
static destroyAll(): Promise<void>;
|
|
36
37
|
/**
|
|
37
|
-
* Destroys the default base folder for sandboxes
|
|
38
|
-
* run before all tests to ensure
|
|
39
|
-
*
|
|
38
|
+
* Destroys the default base folder for sandboxes (or all at the provided
|
|
39
|
+
* path 'at') -- useful as a once-off run before all tests to ensure
|
|
40
|
+
* that there are no lingering sandboxes
|
|
40
41
|
*/
|
|
41
|
-
static destroyAny(): Promise<void>;
|
|
42
|
+
static destroyAny(at?: string): Promise<void>;
|
|
42
43
|
static create(at?: string): Promise<Sandbox>;
|
|
43
44
|
static setBaseTargetToCurrentWorkingDirectory(): Promise<void>;
|
|
44
45
|
static setBaseTargetToSystemTempFolder(): Promise<void>;
|
|
@@ -232,6 +232,9 @@ class Sandbox {
|
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
+
async touch(filePath) {
|
|
236
|
+
await (0, yafs_1.touch)(this.fullPathFor(filePath));
|
|
237
|
+
}
|
|
235
238
|
_validatePathInsideSandbox(t) {
|
|
236
239
|
if (t.startsWith(this.path)) {
|
|
237
240
|
return;
|
|
@@ -253,12 +256,13 @@ class Sandbox {
|
|
|
253
256
|
}
|
|
254
257
|
}
|
|
255
258
|
/**
|
|
256
|
-
* Destroys the default base folder for sandboxes
|
|
257
|
-
* run before all tests to ensure
|
|
258
|
-
*
|
|
259
|
+
* Destroys the default base folder for sandboxes (or all at the provided
|
|
260
|
+
* path 'at') -- useful as a once-off run before all tests to ensure
|
|
261
|
+
* that there are no lingering sandboxes
|
|
259
262
|
*/
|
|
260
|
-
static async destroyAny() {
|
|
261
|
-
const
|
|
263
|
+
static async destroyAny(at) {
|
|
264
|
+
const base = at !== null && at !== void 0 ? at : baseTarget;
|
|
265
|
+
const target = path_1.default.join(base, exports.basePrefix);
|
|
262
266
|
try {
|
|
263
267
|
await (0, yafs_1.rm)(target);
|
|
264
268
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filesystem-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "JavaScript module to provide filesystem sandboxes for testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"release-beta": "cross-env BETA=1 VERSION_INCREMENT_STRATEGY=patch run-s \"zarro release-npm\"",
|
|
24
24
|
"prerelease": "run-s build test",
|
|
25
25
|
"release": "cross-env VERSION_INCREMENT_STRATEGY=minor run-s \"zarro release-npm\"",
|
|
26
|
+
"transpile": "tsc --noEmit",
|
|
26
27
|
"tsc": "tsc",
|
|
27
28
|
"zarro": "zarro"
|
|
28
29
|
},
|
|
@@ -38,14 +39,14 @@
|
|
|
38
39
|
},
|
|
39
40
|
"homepage": "https://github.com/fluffynuts/filesystem-sandbox#readme",
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@faker-js/faker": "^
|
|
42
|
+
"@faker-js/faker": "^9.9.0",
|
|
42
43
|
"@types/debug": "^4.1.12",
|
|
43
44
|
"@types/jest": "^25.2.3",
|
|
44
45
|
"@types/lodash": "^4.14.153",
|
|
45
46
|
"@types/mkdirp": "^1.0.0",
|
|
46
47
|
"@types/node": "^14.0.5",
|
|
47
48
|
"eslint": "^7.1.0",
|
|
48
|
-
"expect-even-more-jest": "^1.
|
|
49
|
+
"expect-even-more-jest": "^1.20.0",
|
|
49
50
|
"expect-more-jest": "^5.1.0",
|
|
50
51
|
"jest": "^28.1.1",
|
|
51
52
|
"lodash": "^4.17.15",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"ts-jest": "^28.0.4",
|
|
54
55
|
"tslint": "^6.1.2",
|
|
55
56
|
"typescript": "^4.6.2",
|
|
56
|
-
"yafs": "^1.
|
|
57
|
+
"yafs": "^1.47.0",
|
|
57
58
|
"zarro": "^1.199.0"
|
|
58
59
|
},
|
|
59
60
|
"dependencies": {
|