Archived
1
0

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:
Asher
2022-03-14 21:37:29 -05:00
committed by GitHub
parent 184ef68147
commit 21c74802e8
27 changed files with 176 additions and 1743 deletions

View File

@ -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")
})

View File

@ -103,7 +103,7 @@ describe("vscode", () => {
it("should do nothing when nothing is passed in", async () => {
codeServer = await integration.setup(["--auth=none"], "")
let resp = await codeServer.fetch("/", undefined)
const resp = await codeServer.fetch("/", undefined)
expect(resp.status).toBe(200)
const url = new URL(resp.url)