Skip to content

Commit e521b7e

Browse files
committed
wip
1 parent 35688b6 commit e521b7e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

test/unit/node/constants.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { logger } from "@coder/logger"
22
import { mockLogger } from "../../utils/helpers"
33
import * as semver from "semver"
4+
import path from "path"
45

56
describe("constants", () => {
67
let constants: typeof import("../../../src/node/constants")
@@ -20,9 +21,14 @@ describe("constants", () => {
2021
}
2122

2223
beforeAll(() => {
24+
jest.clearAllMocks()
2325
mockLogger()
24-
jest.mock("../../../package.json", () => mockPackageJson, { virtual: true })
25-
jest.mock("../../../vendor/modules/code-oss-dev/package.json", () => mockCodePackageJson, { virtual: true })
26+
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
27+
jest.mock(
28+
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"),
29+
() => mockCodePackageJson,
30+
{ virtual: true },
31+
)
2632
constants = require("../../../src/node/constants")
2733
})
2834

@@ -106,8 +112,13 @@ describe("constants", () => {
106112
}
107113

108114
beforeAll(() => {
109-
jest.mock("../../../package.json", () => mockPackageJson, { virtual: true })
110-
jest.mock("../../../vendor/modules/code-oss-dev/package.json", () => mockCodePackageJson, { virtual: true })
115+
jest.clearAllMocks()
116+
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
117+
jest.mock(
118+
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"),
119+
() => mockCodePackageJson,
120+
{ virtual: true },
121+
)
111122
constants = require("../../../src/node/constants")
112123
})
113124

0 commit comments

Comments
 (0)