Skip to content

Commit

Permalink
Always delete test directory after finishing
Browse files Browse the repository at this point in the history
  • Loading branch information
s0 committed Jul 27, 2024
1 parent 516a428 commit 1cf0541
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions jest.integration.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ module.exports = {
ROOT_TEST_BRANCH_PREFIX,
ROOT_TEMP_DIRECTORY,
},
globalTeardown: "<rootDir>/src/test/integration/jest.globalTeardown.ts",
};
12 changes: 12 additions & 0 deletions src/test/integration/jest.globalTeardown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { promises as fs } from "fs";
import { Config } from "jest";

module.exports = async (_: unknown, projectConfig: Config) => {
const directory = projectConfig.globals?.ROOT_TEMP_DIRECTORY;
if (!(typeof directory == "string")) {
throw new Error("ROOT_TEMP_DIRECTORY must be set");
}
console.log(`Deleting directory: ${directory}`);

await fs.rm(directory, { recursive: true });
};

0 comments on commit 1cf0541

Please sign in to comment.