未验证 提交 1c737f1f 编写于 作者: J Joe Previte

refactor: hoist jest.mock in constants

上级 1470ff20
......@@ -4,15 +4,11 @@
import { commit, getPackageJson, version } from "../src/node/constants"
import { loggerModule } from "./helpers"
// jest.mock is hoisted above the imports so we must use `require` here.
jest.mock("@coder/logger", () => require("./helpers").loggerModule)
describe("constants", () => {
describe("getPackageJson", () => {
// let spy: jest.SpyInstance
beforeEach(() => {
// spy = jest.spyOn(logger, "warn")
jest.mock("@coder/logger", () => loggerModule)
})
afterEach(() => {
jest.clearAllMocks()
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册