Skip to content

Commit 1fef624

Browse files
committed
chore: Fix construct-error tests
1 parent 990b870 commit 1fef624

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

packages/gatsby-cli/src/structured-errors/__tests__/construct-error.ts

+9-14
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@ import constructError from "../construct-error"
22
import { errorMap } from "../error-map"
33
import { Level } from "../types"
44

5-
let log
6-
let processExit
7-
beforeEach(() => {
8-
log = jest.spyOn(console, `log`).mockImplementation(() => {})
9-
processExit = (
10-
jest.spyOn(process, `exit`) as unknown as jest.Mock
11-
).mockImplementation(() => {})
5+
const processExit = (
6+
jest.spyOn(process, `exit`) as unknown as jest.Mock
7+
).mockImplementation(() => {})
8+
const log = (
9+
jest.spyOn(console, `log`) as unknown as jest.Mock
10+
).mockImplementation(() => {})
1211

13-
log.mockReset()
14-
processExit.mockReset()
15-
})
16-
17-
afterAll(() => {
18-
;(console.log as jest.Mock).mockClear()
19-
;(process.exit as unknown as jest.Mock).mockClear()
12+
afterEach(() => {
13+
log.mockClear()
14+
processExit.mockClear()
2015
})
2116

2217
test(`it exits on invalid error schema`, () => {

0 commit comments

Comments
 (0)