Skip to content

Commit 8bd4783

Browse files
committed
initial implementation
0 parents  commit 8bd4783

14 files changed

+2819
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
out/

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "extensionHost",
6+
"request": "launch",
7+
"name": "Example adapter",
8+
"runtimeExecutable": "${execPath}",
9+
"args": [
10+
"--extensionDevelopmentPath=${workspaceFolder}"
11+
],
12+
"outFiles": [
13+
"${workspaceFolder}/out"
14+
]
15+
}
16+
]
17+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"files.exclude": {
3+
".git": true,
4+
"node_modules": true,
5+
"out": true
6+
}
7+
}

.vscodeignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
src/**
2+
**/*.map
3+
package-lock.json
4+
tsconfig.json
5+
.vscode/**
6+
.gitignore

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Implementing a Test Adapter for Visual Studio Code
2+
3+
This repository contains an example for implementing a `TestAdapter` extension that works with the
4+
[Test Explorer](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer) extension.
5+
6+
## Setup
7+
8+
* install the [Test Explorer](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer) extension
9+
* fork and clone this repository and open it in VS Code
10+
* run `npm install`
11+
* run `npm run watch` or start the watch Task in VS Code
12+
* start the debugger
13+
14+
You should now see a second VS Code window, the Extension Development Host.
15+
Open a folder in this window and click the "Test" icon in the Activity bar.
16+
Now you should see the fake example test suite in the side panel:
17+
18+
![The fake example test suite](img/fake-tests.png)
19+
20+
## Basic implementation
21+
22+
* add any configuration properties that your Test Adapter needs to the `contributes.configuration.properties` section of `package.json`
23+
* replace the `loadFakeTests()` call in `src/adapter.ts` with your code for loading the test definitions for the real test framework
24+
* replace the `runFakeTests()` call in `src/adapter.ts` with your code for running the tests in a child process using the real test framework
25+
26+
## Getting ready to publish
27+
28+
* search for all occurrences of the word "example" in this project and replace them with the name of the testing framework that your Test Adapter supports
29+
* update `package.json` with your preferred values (at a minimum you should change `author`, `publisher`, `homepage`, `repository` and `bugs`)
30+
* create an icon for your Test Adapter (there's an SVG version of the Test Explorer icon at `img/test-explorer.svg`) and reference it in `package.json`
31+
* replace this README with your documentation
32+
33+
Now you're ready to [publish](https://code.visualstudio.com/docs/extensions/publish-extension) the first version of your Test Adapter.
34+
35+
## Completing the implementation
36+
37+
* implement the `debug()` method
38+
* implement the `cancel()` method (it should kill the child process that was started by `run()` or `debug()`)
39+
* watch the configuration for any changes that may affect the loading of test definitions and reload the test definitions if necessary
40+
* watch the workspace for any changes to the test files and reload the test definitions if necessary
41+
* watch the configuration for any changes that may affect the results of running the tests and emit an `autorun` event if necessary
42+
* watch the workspace for any changes to the source files and emit an `autorun` event if necessary
43+
* ensure that only one test run is active at a time

img/fake-tests.png

5.15 KB
Loading

img/test-explorer.svg

Lines changed: 43 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)