Skip to content

Commit

Permalink
test: use truly global hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed Dec 18, 2023
1 parent e9509b0 commit 23f6f7a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
12 changes: 1 addition & 11 deletions index.test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
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()

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", () => {
Expand Down
14 changes: 14 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -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
}
})
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"/node_modules/",
"testutil.js"
],
"setupFilesAfterEnv": [
"./jest.setup.js"
],
"testTimeout": 60000
},
"engines": {
Expand Down

0 comments on commit 23f6f7a

Please sign in to comment.