Skip to content

Commit f5068ac

Browse files
authored
Merge branch 'main' into fix-empty-test-cases-issue
2 parents 92dca83 + f491294 commit f5068ac

File tree

7 files changed

+408
-82
lines changed

7 files changed

+408
-82
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ jobs:
5050
run: npm test
5151
if: runner.os != 'Linux'
5252

53+
- name: Pack for VSIX Tests
54+
run: npm run package:test
55+
env:
56+
TEST_TEMP: ${{ runner.temp }}
57+
58+
- name: Run VSIX Tests (Linux)
59+
run: xvfb-run -a npm run test:vsix
60+
env:
61+
TEST_TEMP: ${{ runner.temp }}
62+
if: runner.os == 'Linux'
63+
- name: Run VSIX Tests (Win/MacOS)
64+
run: npm run test:vsix
65+
env:
66+
TEST_TEMP: ${{ runner.temp }}
67+
if: runner.os != 'Linux'
68+
5369
- name: Run Linter
5470
if: always()
5571
run: npm run lint

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,4 @@ dist
134134
out
135135
*.vsix
136136
vscode*.d.ts
137+
tmp

.vscode-test.mjs

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,54 @@ import * as fs from 'fs';
33
import * as path from 'path';
44
import { fileURLToPath } from 'url';
55

6+
67
const dirname = fileURLToPath(new URL('.', import.meta.url));
78
const integrationTestDir = path.join(dirname, 'out/test/integration');
89
const workspaceBaseDir = path.join(dirname, 'test-workspaces');
910

1011
const vsCodeVersion = process.env.VSCODE_TEST_VERSION ?? 'stable';
1112
const vsCodePlatform = process.env.VSCODE_TEST_PLATFORM ?? 'desktop';
1213

13-
let createCommonOptions = (label) => {
14-
if (process.env.GITHUB_ACTIONS) {
15-
return {
16-
platform: vsCodePlatform,
17-
version: vsCodeVersion,
18-
env: {
19-
MOCHA_COLORS: 'true',
20-
MOCHA_VSCODE_TEST: 'true'
21-
},
22-
mocha: {
23-
ui: 'bdd',
14+
let extensionDevelopmentPath = '';
2415

25-
reporter: path.join(dirname, '.vscode-ci-test-reporter.js'),
26-
reporterOption: {
27-
jsonReporterOption: {
28-
output: path.join(dirname, 'test-results', `${label}.json`),
29-
},
30-
},
31-
timeout: 60_000,
32-
},
33-
};
34-
} else {
35-
return {
36-
platform: vsCodePlatform,
37-
version: vsCodeVersion,
38-
env: {
39-
MOCHA_VSCODE_TEST: 'true'
40-
},
41-
mocha: {
42-
ui: 'bdd',
43-
timeout: 60_000,
16+
const testMode = process.env.TEST_MODE ?? 'normal';
17+
18+
if (testMode === 'vsix') {
19+
const tempDir = process.env.TEST_TEMP ?? path.join(dirname, 'tmp')
20+
extensionDevelopmentPath = path.resolve(path.join(tempDir, 'vsix', 'extension'));
21+
}
22+
23+
function createCommonOptions(label) {
24+
/**@type {import('@vscode/test-cli').TestConfiguration} */
25+
const options = {
26+
platform: vsCodePlatform,
27+
version: vsCodeVersion,
28+
env: {
29+
MOCHA_VSCODE_TEST: 'true',
30+
},
31+
mocha: {
32+
ui: 'bdd',
33+
timeout: 60_000,
34+
},
35+
};
36+
37+
if (process.env.GITHUB_ACTIONS) {
38+
options.mocha.reporter = path.join(dirname, '.vscode-ci-test-reporter.js');
39+
options.mocha.reporterOption = {
40+
jsonReporterOption: {
41+
output: path.join(dirname, 'test-results', `${testMode}-${label}.json`),
4442
},
4543
};
44+
options.env.MOCHA_COLORS = 'true';
45+
}
46+
47+
if (extensionDevelopmentPath) {
48+
options.extensionDevelopmentPath = extensionDevelopmentPath;
4649
}
47-
};
50+
51+
52+
return options;
53+
}
4854

4955
const config = [
5056
{

0 commit comments

Comments
 (0)