Skip to content

Commit 814c38f

Browse files
authored
Merge pull request #2 from badsyntax/tests
Tests
2 parents 61e998d + baf4928 commit 814c38f

File tree

17 files changed

+433
-15
lines changed

17 files changed

+433
-15
lines changed

.github/workflows/nodejs-build.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Node CI Build
33
on: push
44

55
jobs:
6-
build:
7-
runs-on: ubuntu-latest
6+
build-test-linux:
7+
runs-on: ubuntu-18.04
88

99
strategy:
1010
matrix:
@@ -16,11 +16,41 @@ jobs:
1616
uses: actions/setup-node@v1
1717
with:
1818
node-version: ${{ matrix.node-version }}
19-
- name: Test & build extension
19+
- uses: actions/setup-java@v1
20+
with:
21+
java-version: '12.0.2'
22+
architecture: x64
23+
- name: Install OS dependencies
2024
run: |
21-
sudo apt-get install xvfb
25+
sudo apt install xvfb
2226
export DISPLAY=':99.0'
2327
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
28+
- name: Build & test extension
29+
run: |
30+
npm ci
31+
npm run lint
32+
npm test
33+
34+
build-test-windows:
35+
runs-on: windows-2019
36+
37+
strategy:
38+
matrix:
39+
node-version: [12.x]
40+
41+
steps:
42+
- uses: actions/checkout@v1
43+
- name: Use Node.js ${{ matrix.node-version }}
44+
uses: actions/setup-node@v1
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
- uses: actions/setup-java@v1
48+
with:
49+
java-version: '12.0.2'
50+
architecture: x64
51+
- name: Build & test extension
52+
run: |
2453
npm ci
2554
npm run lint
2655
npm test
56+
shell: pwsh

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
"request": "launch",
2121
"runtimeExecutable": "${execPath}",
2222
"args": [
23+
"--disable-extensions",
2324
"--extensionDevelopmentPath=${workspaceFolder}",
2425
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index",
25-
"./test-fixtures/with-gradle/"
26+
"${workspaceFolder}/test-fixtures/gradle"
2627
],
2728
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
2829
"preLaunchTask": "npm: watch"

.vscodeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ vsc-extension-quickstart.md
88
**/tslint.json
99
**/*.map
1010
**/*.ts
11+
test-fixtures/**
12+
images/**

src/test/runTest.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import { runTests } from 'vscode-test';
44

55
async function main() {
66
try {
7-
const testWorkspace = path.resolve(
8-
__dirname,
9-
'../../../test-fixtures/with-gradle'
10-
);
7+
const testWorkspaces = [
8+
path.resolve(__dirname, '../../test-fixtures/gradle')
9+
];
1110

1211
// The folder containing the Extension Manifest package.json
1312
// Passed to `--extensionDevelopmentPath`
@@ -17,11 +16,15 @@ async function main() {
1716
// Passed to --extensionTestsPath
1817
const extensionTestsPath = path.resolve(__dirname, './suite/index');
1918

20-
// Download VS Code, unzip it and run the integration test
21-
await runTests({
22-
extensionDevelopmentPath,
23-
extensionTestsPath,
24-
launchArgs: [testWorkspace]
19+
testWorkspaces.forEach(async testWorkspace => {
20+
const launchArgs = [testWorkspace, '--disable-extensions'];
21+
22+
// Download VS Code, unzip it and run the integration test
23+
await runTests({
24+
extensionDevelopmentPath,
25+
extensionTestsPath,
26+
launchArgs
27+
});
2528
});
2629
} catch (err) {
2730
console.error('Failed to run tests');

src/test/suite/extension.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import * as vscode from 'vscode';
88
suite('Extension Test Suite', () => {
99
vscode.window.showInformationMessage('Start all tests.');
1010

11-
test.skip('Should activate extension @integration', async () => {
11+
test('Extension should be present', () => {
12+
assert.ok(vscode.extensions.getExtension('richardwillis.vscode-gradle'));
13+
});
14+
15+
test('Should activate extension @integration', async () => {
1216
const extension = vscode.extensions.getExtension(
1317
'richardwillis.vscode-gradle'
1418
);

test-fixtures/gradle/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12/"/>
4+
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5+
<classpathentry kind="output" path="bin/default"/>
6+
</classpath>

test-fixtures/gradle/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build

test-fixtures/gradle/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>gradle</name>
4+
<comment>Project gradle created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
connection.project.dir=
2+
eclipse.preferences.version=1

test-fixtures/gradle/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*
4+
* This is a general purpose Gradle build.
5+
* Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds
6+
*/
7+
8+
apply plugin: "java"

0 commit comments

Comments
 (0)