Skip to content

Commit

Permalink
add an extension sample for the cli test runner (#918)
Browse files Browse the repository at this point in the history
* add an extension sample for the cli test runner

* Add video demo
  • Loading branch information
connor4312 authored Oct 27, 2023
1 parent a8a74c4 commit 4721ef0
Show file tree
Hide file tree
Showing 10 changed files with 2,869 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helloworld-test-cli-sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
out
node_modules
.vscode-test/
*.vsix
5 changes: 5 additions & 0 deletions helloworld-test-cli-sample/.vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
18 changes: 18 additions & 0 deletions helloworld-test-cli-sample/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: watch"
}
]
}
20 changes: 20 additions & 0 deletions helloworld-test-cli-sample/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
18 changes: 18 additions & 0 deletions helloworld-test-cli-sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Hello World Test Sample

This is the Hello World example with integration tests setup.

You can find the accompanying documentation at https://code.visualstudio.com/api/working-with-extensions/testing-extension.

## Demo

https://github.com/microsoft/vscode-extension-samples/assets/2230985/d9253b37-53fb-4d7f-85ea-3459cbf5932e

## Running the Sample

- Run `npm install` in terminal to install dependencies
- Install the [VS Code Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner)
- Start a task `npm: watch` to compile the code
- Run tests, either by:
- Using the Test Explorer view, or
- By running `npm run test` con the commpand line
Loading

0 comments on commit 4721ef0

Please sign in to comment.