Skip to content

Commit 2539a3b

Browse files
committed
refactor: use fixture in installExtension test
Instead of relying on a network to install an extension, we use a fixture - vsix file in the repo. This is also faster.
1 parent 6f9dc48 commit 2539a3b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed
Binary file not shown.

test/integration/installExtension.test.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { stat } from "fs/promises"
2+
import { cwd } from "process"
13
import { clean, tmpdir } from "../utils/helpers"
24
import { runCodeServerCommand } from "../utils/runCodeServerCommand"
35

@@ -12,11 +14,12 @@ describe("--install-extension", () => {
1214
setupFlags = ["--extensions-dir", tempDir]
1315
})
1416
it("should install an extension", async () => {
15-
const extName = "wesbos.theme-cobalt2"
16-
await runCodeServerCommand([...setupFlags, "--install-extension", extName], {})
17-
const { stdout } = await runCodeServerCommand([...setupFlags, "--list-extensions"], {
18-
stdout: "log",
19-
})
20-
expect(stdout).toContain(extName)
17+
const extName = `wesbos.theme-cobalt2-2.1.6`
18+
const vsixFileName = "wesbos.theme-cobalt2-2.1.6.vsix"
19+
const extensionFixture = `${cwd()}/test/integration/fixtures/${vsixFileName}`
20+
await runCodeServerCommand([...setupFlags, "--install-extension", extensionFixture], {})
21+
const pathToExtFolder = `${tempDir}/${extName}`
22+
const statInfo = await stat(pathToExtFolder)
23+
expect(statInfo.isDirectory()).toBe(true)
2124
}, 20000)
2225
})

0 commit comments

Comments
 (0)