Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
mocha: {
color: true,
ui: 'bdd',
},
});
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["ms-vscode.extension-test-runner"]
}
11 changes: 0 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/src/**/*.js" ],
"preLaunchTask": "npm"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
"preLaunchTask": "npm"
}
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/**
.vscode-test/**
.vscode-test.mjs
out/test/**
test/**
src/**
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"format": "tsfmt -r src/*",
"compile": "tsc -watch -p ./",
"lint": "eslint 'src/**/*.ts' 'test/**/*.ts'",
"test": "node ./out/test/runTests"
"test": "vscode-test"
},
"contributes": {
"languages": [
Expand Down Expand Up @@ -72,17 +72,17 @@
}
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^10.0.0",
"@types/node": "^22.0.0",
"@types/sinon": "^17.0.0",
"@types/vscode": "^1.32.0",
"@vscode/test-electron": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vscode/test-cli": "^0.0.15",
"@vscode/test-electron": "^3.1.0",
"chai": "^4.4.0",
"eslint": "^8.57.0",
"mocha": "^10.0.0",
"proxyquire": "^2.1.3",
"sinon": "^19.0.0",
"typescript": "^5.0.0"
Expand Down
31 changes: 0 additions & 31 deletions test/index.ts

This file was deleted.

File renamed without changes.
14 changes: 0 additions & 14 deletions test/runTests.ts

This file was deleted.

6 changes: 3 additions & 3 deletions vsc-extension-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ We pass the function containing the implementation of the command as the second
* you can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`

## Run tests
* open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`
* press `F5` to run the tests in a new window with your extension loaded
* see the output of the test result in the debug console
* compile with `yarn run vscode:prepublish` (or keep `yarn compile` running), then run `yarn test`
* to run or debug tests from the editor, install the recommended [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner) and use the Testing view
* test runs are configured in `.vscode-test.mjs`
* make changes to `test/extension.test.ts` or create new test files inside the `test` folder
* by convention, the test runner will only consider files matching the name pattern `**.test.ts`
* you can create folders inside the `test` folder to structure your tests any way you want
Loading
Loading