diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f17d2aee..3769353c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,9 +29,8 @@ jobs: - name: Build vscode extension run: | - cd apps/vscode yarn install - yarn run build + yarn run build-vscode - name: Compile and run tests run: | diff --git a/apps/vscode/.vscode-test.mjs b/apps/vscode/.vscode-test.mjs index 638bef89..e9ecc398 100644 --- a/apps/vscode/.vscode-test.mjs +++ b/apps/vscode/.vscode-test.mjs @@ -5,7 +5,7 @@ export default defineConfig([ files: 'test-out/*.test.js', workspaceFolder: 'src/test/examples', mocha: { - timeout: 3000, + timeout: 5000, }, }, ]); diff --git a/apps/vscode/src/test/quartoDoc.test.ts b/apps/vscode/src/test/quartoDoc.test.ts index deb7d879..87c7f5e5 100644 --- a/apps/vscode/src/test/quartoDoc.test.ts +++ b/apps/vscode/src/test/quartoDoc.test.ts @@ -4,7 +4,7 @@ import { exampleWorkspacePath, exampleWorkspaceOutPath, copyFile, wait } from ". import { isQuartoDoc } from "../core/doc"; import { extension } from "./extension"; -const APPROX_TIME_TO_OPEN_VISUAL_EDITOR = 1600; +const APPROX_TIME_TO_OPEN_VISUAL_EDITOR = 1700; suite("Quarto basics", function () { // Before we run any tests, we should copy any files that get edited in the tests to file under `exampleWorkspaceOutPath` @@ -23,12 +23,11 @@ suite("Quarto basics", function () { // Note: the following tests may be flaky. They rely on waiting estimated amounts of time for commands to complete. test("Can edit in visual mode", async function () { - // don't run this in CI for now because we haven't figured out how to get the LSP to start - if (process.env['CI']) this.skip(); - const doc = await vscode.workspace.openTextDocument(exampleWorkspaceOutPath("hello.qmd")); const editor = await vscode.window.showTextDocument(doc); + await extension().activate(); + // manually confirm visual mode so dialogue pop-up doesn't show because dialogues cause test errors // and switch to visual editor await vscode.commands.executeCommand("quarto.test_setkVisualModeConfirmedTrue"); @@ -42,12 +41,11 @@ suite("Quarto basics", function () { // test. That's okay for this test, but could cause issues if you expect a qmd to look how it // does in `/examples`. test("Roundtrip doesn't change hello.qmd", async function () { - // don't run this in CI for now because we haven't figured out how to get the LSP to start - if (process.env['CI']) this.skip(); - const doc = await vscode.workspace.openTextDocument(exampleWorkspaceOutPath("hello.qmd")); const editor = await vscode.window.showTextDocument(doc); + await extension().activate(); + const docTextBefore = doc.getText(); // switch to visual editor and back @@ -59,6 +57,6 @@ suite("Quarto basics", function () { await wait(300); const docTextAfter = doc.getText(); - assert.ok(docTextBefore === docTextAfter); + assert.ok(docTextBefore === docTextAfter, docTextAfter); }); }); diff --git a/package.json b/package.json index 544c54d3..f4976c3b 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build": "turbo run build", "dev-writer": "turbo run dev --filter writer*", "dev-vscode": "turbo run dev --filter quarto...", + "build-vscode": "turbo run build --filter quarto...", "test-vscode": "cd apps/vscode && yarn test", "install-vscode": "cd apps/vscode && yarn install-vscode", "install-positron": "cd apps/vscode && yarn install-positron",