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
15
15
.luarc.json
16
16
.ipynb_checkpoints
17
17
/.luarc.json
18
+ .vscode-test
19
+ * .vsix
Original file line number Diff line number Diff line change 1
1
out /
2
2
* .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
7
7
yarn dev-vscode # run development/debug version of extension
8
8
```
9
9
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
+
10
16
Install the dev version of the extension in VS Code or Positron with:
11
17
12
18
``` sh
13
19
yarn install-vscode
14
20
yarn install-positron
15
21
```
16
22
17
-
18
23
# Debugging the extension
19
24
20
25
The 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 14
14
*/
15
15
16
16
import { runBuild } from "build" ;
17
+ import * as glob from "glob" ;
17
18
18
19
const args = process . argv ;
19
20
const dev = args [ 2 ] === "dev" ;
21
+ const test = args [ 2 ] === "test" ;
22
+ const testFiles = glob . sync ( "src/test/*.ts" ) ;
20
23
21
- runBuild ( {
24
+ const testBuildOptions = {
25
+ entryPoints : testFiles ,
26
+ outdir : 'test-out' ,
27
+ external : [ 'vscode' ] ,
28
+ } ;
29
+
30
+ const defaultBuildOptions = {
22
31
entryPoints : [ './src/main.ts' ] ,
23
32
outfile : './out/main.js' ,
24
33
external : [ 'vscode' ] ,
25
34
minify : ! dev ,
26
35
dev
27
- } ) ;
36
+ } ;
37
+
38
+ runBuild ( test ? testBuildOptions : defaultBuildOptions ) ;
Original file line number Diff line number Diff line change 1426
1426
"build" : " tsx build.ts" ,
1427
1427
"dev" : " yarn run build dev" ,
1428
1428
"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"
1430
1431
},
1431
1432
"dependencies" : {
1432
1433
"axios" : " ^1.2.1" ,
1435
1436
"editor-core" : " *" ,
1436
1437
"editor-server" : " *" ,
1437
1438
"editor-types" : " *" ,
1439
+ "glob" : " ^11.0.3" ,
1438
1440
"highlight.js" : " ^11.7.0" ,
1439
1441
"js-yaml" : " ^4.1.0" ,
1440
1442
"lodash.debounce" : " ^4.0.8" ,
1472
1474
"@types/which" : " ^2.0.2" ,
1473
1475
"@typescript-eslint/eslint-plugin" : " ^5.45.0" ,
1474
1476
"@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" ,
1476
1479
"@vscode/vsce" : " ^2.15.0" ,
1477
1480
"build" : " *" ,
1478
1481
"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