Skip to content

Commit

Permalink
Don't update vscode when tests are running
Browse files Browse the repository at this point in the history
  • Loading branch information
badsyntax committed May 18, 2020
1 parent 7f0915f commit b9f1bb2
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
matrix:
node-version: [12.16.2]
java-version: ['8', '11']
os: [ubuntu-latest, windows-latest] # unable to test on macos-latest, see https://github.com/microsoft/vscode/issues/98080
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node ${{ matrix.node-version }}
Expand Down
40 changes: 24 additions & 16 deletions extension/src/test/runTests.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/* eslint-disable sonarjs/no-duplicate-string */
import * as path from 'path';

import { runTests } from 'vscode-test';
import { runTests, downloadAndUnzipVSCode } from 'vscode-test';

const extensionDevelopmentPath = path.resolve(__dirname, '../../');
const VSCODE_VERSION = '1.45.0';

async function runTestsWithGradle(): Promise<void> {
async function runTestsWithGradle(vscodeExecutablePath: string): Promise<void> {
const fixtures = [
'gradle-groovy-default-build-file',
'gradle-kotlin-default-build-file',
'gradle-groovy-custom-build-file',
];
for (const fixture of fixtures) {
await runTests({
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath: path.resolve(__dirname, 'gradle'),
launchArgs: [
Expand All @@ -27,8 +29,9 @@ async function runTestsWithGradle(): Promise<void> {
}
}

async function runTestsWithoutGradle(): Promise<void> {
await runTests({
function runTestsWithoutGradle(vscodeExecutablePath: string): Promise<number> {
return runTests({
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath: path.resolve(__dirname, 'no-gradle'),
launchArgs: [
Expand All @@ -41,8 +44,9 @@ async function runTestsWithoutGradle(): Promise<void> {
});
}

async function runTestsWithMultiRoot(): Promise<void> {
await runTests({
function runTestsWithMultiRoot(vscodeExecutablePath: string): Promise<number> {
return runTests({
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath: path.resolve(__dirname, 'multi-root'),
launchArgs: [
Expand All @@ -59,8 +63,11 @@ async function runTestsWithMultiRoot(): Promise<void> {
});
}

async function runTestsWithMultiProject(): Promise<void> {
await runTests({
async function runTestsWithMultiProject(
vscodeExecutablePath: string
): Promise<number> {
return runTests({
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath: path.resolve(__dirname, 'multi-project'),
launchArgs: [
Expand All @@ -75,14 +82,15 @@ async function runTestsWithMultiProject(): Promise<void> {
}

async function main(): Promise<void> {
try {
await runTestsWithGradle();
await runTestsWithMultiRoot();
await runTestsWithMultiProject();
await runTestsWithoutGradle();
} catch (err) {
process.exit(1);
}
const vscodeExecutablePath = await downloadAndUnzipVSCode(VSCODE_VERSION);

runTestsWithGradle(vscodeExecutablePath)
.then(() => runTestsWithMultiRoot(vscodeExecutablePath))
.then(() => runTestsWithMultiProject(vscodeExecutablePath))
.then(() => runTestsWithoutGradle(vscodeExecutablePath))
.catch((err) => {
console.error('Error running tests:', err.message);
});
}

main();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"update.mode": "none"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@

# Ignore Gradle build output directory
build

# Ignore .vscode settings
.vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"update.mode": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"update.mode": "none"
}
3 changes: 3 additions & 0 deletions extension/test-fixtures/multi-project/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"update.mode": "none"
}

0 comments on commit b9f1bb2

Please sign in to comment.