diff --git a/index.test.js b/index.test.js index 83d960a..d87276e 100644 --- a/index.test.js +++ b/index.test.js @@ -1,7 +1,6 @@ import { jest } from "@jest/globals" -import { runAction, Mute, runJS, ignoreInstalled, testCwd } from "./testutil" -import fs from "fs" +import { runAction, Mute, runJS, ignoreInstalled } from "./testutil" Mute.all() @@ -9,15 +8,6 @@ const NO_TEST_JAVA = !!process.env.NO_TEST_JAVA beforeAll(() => { process.env.RUN_ASYNC = "false" - fs.mkdirSync(testCwd) -}) - -afterAll(() => { - try { - fs.rmdirSync(testCwd) - } catch (ignored) { - // If the folder doesn't exist it's ok - } }) describe("skipping slow tests", () => { diff --git a/jest.setup.js b/jest.setup.js new file mode 100644 index 0000000..3e8fdb1 --- /dev/null +++ b/jest.setup.js @@ -0,0 +1,14 @@ +import fs from "fs" +import { testCwd } from "./testutil.js" + +beforeAll(() => { + fs.mkdirSync(testCwd) +}) + +afterAll(() => { + try { + fs.rmdirSync(testCwd) + } catch (ignored) { + // If the folder doesn't exist it's ok + } +}) diff --git a/package.json b/package.json index 453fe99..9304225 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,9 @@ "/node_modules/", "testutil.js" ], + "setupFilesAfterEnv": [ + "./jest.setup.js" + ], "testTimeout": 60000 }, "engines": {