Skip to content

Commit

Permalink
clean up temp dir after test
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiAnAn committed May 1, 2021
1 parent 739a122 commit 02a697a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions e2e/__tests__/globalSetup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const customTransformDIR = path.join(
const nodeModulesDIR = path.join(tmpdir(), 'jest-global-setup-node-modules');
const rejectionDir = path.join(tmpdir(), 'jest-global-setup-rejection');
const e2eDir = path.resolve(__dirname, '../global-setup');
const esmTmpDir = path.join(tmpdir(), 'jest-global-setup-esm');

beforeAll(() => {
runYarnInstall(e2eDir);
Expand All @@ -39,6 +40,7 @@ beforeEach(() => {
cleanup(customTransformDIR);
cleanup(nodeModulesDIR);
cleanup(rejectionDir);
cleanup(esmTmpDir);
});

afterAll(() => {
Expand All @@ -48,6 +50,7 @@ afterAll(() => {
cleanup(customTransformDIR);
cleanup(nodeModulesDIR);
cleanup(rejectionDir);
cleanup(esmTmpDir);
});

test('globalSetup is triggered once before all test suites', () => {
Expand Down
3 changes: 3 additions & 0 deletions e2e/__tests__/globalTeardown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const DIR = path.join(tmpdir(), 'jest-global-teardown');
const project1DIR = path.join(tmpdir(), 'jest-global-teardown-project-1');
const project2DIR = path.join(tmpdir(), 'jest-global-teardown-project-2');
const e2eDir = path.resolve(__dirname, '../global-teardown');
const esmTmpDir = path.join(tmpdir(), 'jest-global-teardown-esm');

beforeAll(() => {
runYarnInstall(e2eDir);
Expand All @@ -26,11 +27,13 @@ beforeEach(() => {
cleanup(DIR);
cleanup(project1DIR);
cleanup(project2DIR);
cleanup(esmTmpDir);
});
afterAll(() => {
cleanup(DIR);
cleanup(project1DIR);
cleanup(project2DIR);
cleanup(esmTmpDir);
});

test('globalTeardown is triggered once after all test suites', () => {
Expand Down

0 comments on commit 02a697a

Please sign in to comment.