Skip to content

Commit 3f19991

Browse files
committed
Make a simpler test and simpler yarn test setup
1 parent d59b40a commit 3f19991

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

apps/vscode/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,8 +1414,7 @@
14141414
"dev": "yarn run build dev",
14151415
"lint": "eslint src --ext ts",
14161416
"build-lang": "node syntaxes/build-lang",
1417-
"test-build": "yarn run build test",
1418-
"test": "vscode-test"
1417+
"test": "yarn run build test && vscode-test"
14191418
},
14201419
"dependencies": {
14211420
"axios": "^1.2.1",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as vscode from "vscode";
2+
import * as assert from "assert";
3+
import { exampleWorkspacePath } from "./test-utils";
4+
import { isQuartoDoc } from "../core/doc";
5+
6+
suite("Quarto basics", () => {
7+
test("Can open a Quarto document", async () => {
8+
const doc = await vscode.workspace.openTextDocument(exampleWorkspacePath("hello.qmd"));
9+
const editor = await vscode.window.showTextDocument(doc);
10+
assert.strictEqual(editor?.document.languageId, "quarto");
11+
assert.strictEqual(isQuartoDoc(editor?.document), true);
12+
});
13+
});

apps/vscode/src/test/test-utils.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as path from "path";
2+
3+
4+
/**
5+
* Path to the root directory of the extension:
6+
* https://github.com/microsoft/vscode-python-tools-extension-template/blob/main/src/common/constants.ts
7+
*/
8+
export const EXTENSION_ROOT_DIR =
9+
path.basename(__dirname) === "common"
10+
? path.dirname(path.dirname(__dirname))
11+
: path.dirname(__dirname);
12+
13+
export const TEST_PATH = path.join(EXTENSION_ROOT_DIR, "src", "test");
14+
export const WORKSPACE_PATH = path.join(TEST_PATH, "examples");
15+
16+
export function exampleWorkspacePath(file: string): string {
17+
return path.join(WORKSPACE_PATH, file);
18+
}

apps/vscode/src/test/toggle.test.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)