Skip to content

Commit 6023fdb

Browse files
committed
fix: ignore EBUSY windows errors when removing temporary folders in CI
1 parent 4916b08 commit 6023fdb

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

app-config-test-utils/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"dependencies": {
3333
"@app-config/logging": "^2.4.2",
34+
"@app-config/utils": "^2.4.2",
3435
"@types/fs-extra": "9",
3536
"@types/tmp": "0.2",
3637
"fs-extra": "9",

app-config-test-utils/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { dir } from 'tmp-promise';
33
import { outputFile, remove } from 'fs-extra';
44
import { stdin } from 'mock-stdin';
55
import { isTestEnvAndShouldNotPrompt } from '@app-config/logging';
6+
import { isWindows } from '@app-config/utils';
67

78
// function that joins the temp dir to a filename
89
type JoinDir = (filename: string) => string;
@@ -32,7 +33,14 @@ export async function withTempFiles(
3233

3334
await callback((filename) => join(folder, filename), folder);
3435
} finally {
35-
await remove(folder);
36+
await remove(folder).catch((error) => {
37+
console.warn(error);
38+
39+
// we'll just ignore this, it's spurious in CI
40+
if (isWindows && error.code !== 'EBUSY') {
41+
throw error;
42+
}
43+
});
3644
}
3745
}
3846

app-config-test-utils/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"include": ["src"],
88
"exclude": ["node_modules"],
99
"references": [
10-
{ "path": "../app-config-logging" }
10+
{ "path": "../app-config-logging" },
11+
{ "path": "../app-config-utils" }
1112
]
1213
}

0 commit comments

Comments
 (0)