From 133b25bbfeaf08e81864bc83aa5781cd4b72565d Mon Sep 17 00:00:00 2001 From: elliot Date: Tue, 14 Oct 2025 17:34:14 -0400 Subject: [PATCH] Add test to check that the extension does not cause issues with non-qmd files --- apps/vscode/src/test/examples/hello.lua | 1 + apps/vscode/src/test/quartoDoc.test.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 apps/vscode/src/test/examples/hello.lua diff --git a/apps/vscode/src/test/examples/hello.lua b/apps/vscode/src/test/examples/hello.lua new file mode 100644 index 00000000..ad35e5ae --- /dev/null +++ b/apps/vscode/src/test/examples/hello.lua @@ -0,0 +1 @@ +print("Hello World") diff --git a/apps/vscode/src/test/quartoDoc.test.ts b/apps/vscode/src/test/quartoDoc.test.ts index d4ca47aa..9e0c804d 100644 --- a/apps/vscode/src/test/quartoDoc.test.ts +++ b/apps/vscode/src/test/quartoDoc.test.ts @@ -41,6 +41,20 @@ suite("Quarto basics", function () { roundtripSnapshotTest('capsule-leak.qmd'); roundtripSnapshotTest('attr-equals.qmd'); + + // a test to prevent situations like https://github.com/quarto-dev/quarto/issues/845 + test("Can open a non-qmd file normally", async function () { + const { editor, doc } = await openAndShowTextDocument("hello.lua"); + + editor.edit((editBuilder) => { + editBuilder.insert(new vscode.Position(0, 0), 'print("hiyo")\n'); + }); + doc.save(); + + await wait(1700); // approximate time to open visual editor, just in case + + assert.equal(vscode.window.activeTextEditor, editor, 'quarto extension interferes with other files opened in VSCode!'); + }); }); /**