|
| 1 | +import { rename } from "fs/promises" |
| 2 | +import path from "path" |
| 3 | +import extract from "extract-zip" |
| 4 | +import { clean, tmpdir } from "../utils/helpers" |
| 5 | +import { runCodeServerCommand } from "../utils/runCodeServerCommand" |
| 6 | + |
| 7 | +describe("--list-extensions", () => { |
| 8 | + const testName = "listExtensions" |
| 9 | + const extName = `wesbos.theme-cobalt2` |
| 10 | + const extVersion = "2.1.6" |
| 11 | + const vsixFileName = `${extName}-${extVersion}.vsix` |
| 12 | + let tempDir: string |
| 13 | + let setupFlags: string[] |
| 14 | + |
| 15 | + beforeEach(async () => { |
| 16 | + await clean(testName) |
| 17 | + tempDir = await tmpdir(testName) |
| 18 | + setupFlags = ["--extensions-dir", tempDir] |
| 19 | + const extensionFixture = path.resolve(`./test/integration/fixtures/${vsixFileName}`) |
| 20 | + // Make folder because this is where we'll move the extension |
| 21 | + const pathToUnpackedExtension = path.join(tempDir, `${extName}-${extVersion}`) |
| 22 | + const tempPathToUnpackedExtension = path.join(tempDir, `${extName}-temp`) |
| 23 | + await extract(extensionFixture, { dir: tempPathToUnpackedExtension }) |
| 24 | + await rename(path.join(tempPathToUnpackedExtension, "extension", pathToUnpackedExtension)) |
| 25 | + }) |
| 26 | + it("should list installed extensions", async () => { |
| 27 | + const { stdout } = await runCodeServerCommand([...setupFlags, "--list-extensions"]) |
| 28 | + expect(stdout).toMatch(extName) |
| 29 | + }, 20000) |
| 30 | +}) |
0 commit comments