mirror of https://git.tuxpa.in/a/code-server.git
refactor: hoist jest.mock in constants
This commit is contained in:
parent
1470ff203a
commit
1c737f1f93
|
@ -4,15 +4,11 @@
|
||||||
import { commit, getPackageJson, version } from "../src/node/constants"
|
import { commit, getPackageJson, version } from "../src/node/constants"
|
||||||
import { loggerModule } from "./helpers"
|
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("constants", () => {
|
||||||
describe("getPackageJson", () => {
|
describe("getPackageJson", () => {
|
||||||
// let spy: jest.SpyInstance
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
// spy = jest.spyOn(logger, "warn")
|
|
||||||
jest.mock("@coder/logger", () => loggerModule)
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue