File tree Expand file tree Collapse file tree 14 files changed +4242
-2505
lines changed Expand file tree Collapse file tree 14 files changed +4242
-2505
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1+
2+ name : Test VS Code Extension
3+
4+ on :
5+ push :
6+ branches :
7+ - main
8+ pull_request :
9+ branches :
10+ - main
11+ workflow_dispatch :
12+
13+ jobs :
14+ test-extension :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - uses : actions/setup-node@v4
20+ with :
21+ node-version : latest
22+
23+ - name : Update build environment and install XVFB
24+ run : |
25+ sudo apt-get -y update
26+ sudo apt-get -y install --fix-missing xvfb
27+
28+ - name : Compile and run tests
29+ run : |
30+ yarn install --immutable --immutable-cache --check-cache
31+ xvfb-run yarn test-vscode
Original file line number Diff line number Diff line change @@ -15,3 +15,5 @@ public/dist
1515.luarc.json
1616.ipynb_checkpoints
1717/.luarc.json
18+ .vscode-test
19+ * .vsix
Original file line number Diff line number Diff line change 11out /
22* .vsix
3+ test-out /
Original file line number Diff line number Diff line change 1+ import { defineConfig } from '@vscode/test-cli' ;
2+
3+ export default defineConfig ( [
4+ {
5+ files : 'test-out/*.test.js' ,
6+ workspaceFolder : 'src/test/examples' ,
7+ } ,
8+ ] ) ;
Original file line number Diff line number Diff line change @@ -7,14 +7,19 @@ yarn # install dependencies
77yarn dev-vscode # run development/debug version of extension
88```
99
10+ Run the extension tests with:
11+
12+ ``` sh
13+ yarn test-vscode # compile the test files and run them with the vscode-test CLI
14+ ```
15+
1016Install the dev version of the extension in VS Code or Positron with:
1117
1218``` sh
1319yarn install-vscode
1420yarn install-positron
1521```
1622
17-
1823# Debugging the extension
1924
2025The extension must have been built in dev mode (see the build section). The ` dev ` build flag is essential for debugging:
Original file line number Diff line number Diff line change 1414 */
1515
1616import { runBuild } from "build" ;
17+ import * as glob from "glob" ;
1718
1819const args = process . argv ;
1920const dev = args [ 2 ] === "dev" ;
21+ const test = args [ 2 ] === "test" ;
22+ const testFiles = glob . sync ( "src/test/*.ts" ) ;
2023
21- runBuild ( {
24+ const testBuildOptions = {
25+ entryPoints : testFiles ,
26+ outdir : 'test-out' ,
27+ external : [ 'vscode' ] ,
28+ } ;
29+
30+ const defaultBuildOptions = {
2231 entryPoints : [ './src/main.ts' ] ,
2332 outfile : './out/main.js' ,
2433 external : [ 'vscode' ] ,
2534 minify : ! dev ,
2635 dev
27- } ) ;
36+ } ;
37+
38+ runBuild ( test ? testBuildOptions : defaultBuildOptions ) ;
Original file line number Diff line number Diff line change 14261426 "build" : " tsx build.ts" ,
14271427 "dev" : " yarn run build dev" ,
14281428 "lint" : " eslint src --ext ts" ,
1429- "build-lang" : " node syntaxes/build-lang"
1429+ "build-lang" : " node syntaxes/build-lang" ,
1430+ "test" : " yarn run build test && vscode-test"
14301431 },
14311432 "dependencies" : {
14321433 "axios" : " ^1.2.1" ,
14351436 "editor-core" : " *" ,
14361437 "editor-server" : " *" ,
14371438 "editor-types" : " *" ,
1439+ "glob" : " ^11.0.3" ,
14381440 "highlight.js" : " ^11.7.0" ,
14391441 "js-yaml" : " ^4.1.0" ,
14401442 "lodash.debounce" : " ^4.0.8" ,
14721474 "@types/which" : " ^2.0.2" ,
14731475 "@typescript-eslint/eslint-plugin" : " ^5.45.0" ,
14741476 "@typescript-eslint/parser" : " ^5.45.0" ,
1475- "@vscode/test-electron" : " ^2.2.0" ,
1477+ "@vscode/test-cli" : " ^0.0.11" ,
1478+ "@vscode/test-electron" : " ^2.5.2" ,
14761479 "@vscode/vsce" : " ^2.15.0" ,
14771480 "build" : " *" ,
14781481 "esbuild" : " ^0.16.7" ,
Original file line number Diff line number Diff line change 1+ ---
2+ title : " Hello, Quarto"
3+ format : html
4+ ---
5+
6+ ## Header
7+
8+ ``` {python}
9+ 1 + 1
10+ ```
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments