Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds vscode-test package that allows for testing extension.
We configure it's user data directory because it creates a socket and socket's path is used as a key. Unfortunately, it only supports 103 characters so long paths get trimmed and it doesn't clean the socket before next run.
For tests, it uses mocha. We additionally use sinon for creating mocks.
Mocha only supports JS files, we transpile them using TS in the dist directory, under
test/
. We ignore this directory when creating a VSIX package.Tests are structured as follows:
integration-tests
directory for more end-to-end testing.XXX.test.ts
files next to implementation to unit test it.To run tests execute
npm run test
command which rebuilds webview and extension, then running tests.It expects simulator executable in the dist directory, you can regenerate it with
npm run build:sim-server-debug
.Few sources that can be used as a reference for writing tests: