chore: move Code to a submodule (#4990)
* Move Code to a submodule Closes #4901. * Base Code cache on hash and re-enable node_modules cache The current setup appears to only rebuild VS Code if the dependencies change but we need to rebuild it if anything changes. I also re-enabled the commented out node_modules caches. They look like they should work to me with the submodule method. I think the problem occurred because Code itself was being installed in the yarn step.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { logger } from "@coder/logger"
|
||||
import { mockLogger } from "../../utils/helpers"
|
||||
import * as semver from "semver"
|
||||
import path from "path"
|
||||
import * as semver from "semver"
|
||||
import { mockLogger } from "../../utils/helpers"
|
||||
|
||||
describe("constants", () => {
|
||||
let constants: typeof import("../../../src/node/constants")
|
||||
@ -16,7 +16,7 @@ describe("constants", () => {
|
||||
}
|
||||
|
||||
const mockCodePackageJson = {
|
||||
name: "mock-code-oss-dev",
|
||||
name: "mock-vscode",
|
||||
version: "1.2.3",
|
||||
}
|
||||
|
||||
@ -24,11 +24,9 @@ describe("constants", () => {
|
||||
jest.clearAllMocks()
|
||||
mockLogger()
|
||||
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
|
||||
jest.mock(
|
||||
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"),
|
||||
() => mockCodePackageJson,
|
||||
{ virtual: true },
|
||||
)
|
||||
jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, {
|
||||
virtual: true,
|
||||
})
|
||||
constants = require("../../../src/node/constants")
|
||||
})
|
||||
|
||||
@ -96,7 +94,7 @@ describe("constants", () => {
|
||||
const packageJson = constants.getPackageJson("../../package.json")
|
||||
expect(packageJson).toStrictEqual(mockPackageJson)
|
||||
|
||||
const codePackageJson = constants.getPackageJson("../../vendor/modules/code-oss-dev/package.json")
|
||||
const codePackageJson = constants.getPackageJson("../../lib/vscode/package.json")
|
||||
expect(codePackageJson).toStrictEqual(mockCodePackageJson)
|
||||
})
|
||||
})
|
||||
@ -107,17 +105,15 @@ describe("constants", () => {
|
||||
name: "mock-code-server",
|
||||
}
|
||||
const mockCodePackageJson = {
|
||||
name: "mock-code-oss-dev",
|
||||
name: "mock-vscode",
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
jest.clearAllMocks()
|
||||
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
|
||||
jest.mock(
|
||||
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"),
|
||||
() => mockCodePackageJson,
|
||||
{ virtual: true },
|
||||
)
|
||||
jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, {
|
||||
virtual: true,
|
||||
})
|
||||
constants = require("../../../src/node/constants")
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user