filesystem-sandbox 1.25.0 → 1.27.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.
@@ -79,9 +79,14 @@ class Sandbox {
79
79
  return this._path;
80
80
  }
81
81
  async destroy() {
82
- await this.tryDestroySelf();
83
- await this.tryDestroyContainer();
84
- await this.tryDestroyAt();
82
+ try {
83
+ await this.tryDestroySelf();
84
+ await this.tryDestroyContainer();
85
+ await this.tryDestroyAt();
86
+ }
87
+ catch (e) {
88
+ console.warn(`sandbox destruction did not complete - if you see this regularly, please raise an issue`, e);
89
+ }
85
90
  }
86
91
  async tryDestroyAt() {
87
92
  if (!this._at) {
@@ -93,9 +98,18 @@ class Sandbox {
93
98
  await this.destroyFolderIfEmpty(this._base);
94
99
  }
95
100
  async destroyFolderIfEmpty(p) {
96
- const contents = await readdir(p);
101
+ const contents = await (0, yafs_1.ls)(p);
97
102
  if (!contents.length) {
98
- await (0, yafs_1.rm)(p);
103
+ try {
104
+ await (0, yafs_1.rm)(p);
105
+ }
106
+ catch (e) {
107
+ // suppress: the method is literally
108
+ // "destroy folder if empty", and
109
+ // I sometimes see errors at CI where
110
+ // this folder isn't empty at the point
111
+ // of calling rm - likely a clash with another test
112
+ }
99
113
  }
100
114
  }
101
115
  async tryDestroySelf() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filesystem-sandbox",
3
- "version": "1.25.0",
3
+ "version": "1.27.0",
4
4
  "description": "JavaScript module to provide filesystem sandboxes for testing",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",