From 9bf734817deaaf3e06b0eccac2423092bd1427c5 Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Thu, 5 Oct 2023 17:03:42 +0200 Subject: [PATCH] test: Remove test tmp folder after all tests are finished --- jest.config.js | 1 + test/util/TeardownTests.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 test/util/TeardownTests.ts diff --git a/jest.config.js b/jest.config.js index 3c080fa6d..63c2e1b35 100644 --- a/jest.config.js +++ b/jest.config.js @@ -40,6 +40,7 @@ module.exports = { ], testEnvironment: 'node', globalSetup: '/test/util/SetupTests.ts', + globalTeardown: '/test/util/TeardownTests.ts', setupFilesAfterEnv: [ 'jest-rdf' ], collectCoverage: false, // See https://github.com/matthieubosquet/ts-dpop/issues/13 diff --git a/test/util/TeardownTests.ts b/test/util/TeardownTests.ts new file mode 100644 index 000000000..69d376b79 --- /dev/null +++ b/test/util/TeardownTests.ts @@ -0,0 +1,7 @@ +import { getTestFolder, removeFolder } from '../integration/Config'; + +// Jest global teardown requires a single function to be exported +export default async function(): Promise { + // Clean up the root test folder + await removeFolder(getTestFolder('')); +}