Skip to content

Commit

Permalink
Test VS Code Version Matrix (#886)
Browse files Browse the repository at this point in the history
* Test VS Code Version Matrix

Change default `npm test` behavior to use the version of VS Code specified in the `VSCODE_VERSION` environment variable, instead of testing hardcoded versions inside `runtest.ts`.

`VSCODE_VERSION` supports stable, insiders and version numbers like 1.58.2.

If the `VSCODE_VERSION` environment variable is not specified, then the latest stable version of VS Code is automatically used.
  • Loading branch information
jpogran authored Jan 10, 2022
1 parent e112756 commit 30c55b8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ jobs:

test:
strategy:
fail-fast: false
matrix:
vscode:
- '1.58.2'
- 'insiders'
- 'stable'
os:
- windows-latest
- macos-latest
Expand Down Expand Up @@ -119,3 +124,4 @@ jobs:
env:
CI: true
DISPLAY: ':99.0'
VSCODE_VERSION: ${{ matrix.vscode }}
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,6 @@
"ts-jest": "^27.1.0",
"typescript": "^3.9.7",
"vsce": "^1.93.0",
"vscode-test": "^1.5.2"
"@vscode/test-electron": "^2.0.1"
}
}
15 changes: 4 additions & 11 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import { runTests } from 'vscode-test';
import { TestOptions } from 'vscode-test/out/runTest';
import { runTests } from '@vscode/test-electron';
import { TestOptions } from '@vscode/test-electron/out/runTest';
import { exec } from '../utils';

async function terraformInit() {
Expand Down Expand Up @@ -32,6 +32,7 @@ async function main(): Promise<void> {

// common options for all runners
const options: TestOptions = {
version: process.env['VSCODE_VERSION'] ?? 'stable',
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: ['testFixture', '--disable-extensions', '--disable-workspace-trust'],
Expand All @@ -41,15 +42,7 @@ async function main(): Promise<void> {
// Download VS Code, unzip it and run the integration test
// start in the fixtures folder to prevent the language server from walking all the
// project root folders, like node_modules
console.log('_______________LATEST_____________________');
await runTests(options);

console.log('_______________INSIDERS___________________');
options.version = 'insiders';
await runTests(options);

console.log('________________1.55.0____________________');
options.version = '1.55.0';
console.log(`_______________${options.version}_____________________`);
await runTests(options);
} catch (err) {
console.error(err);
Expand Down

0 comments on commit 30c55b8

Please sign in to comment.