Skip to content

Commit 4eceb88

Browse files
committed
wip: build show integration tests
1 parent 33d8825 commit 4eceb88

6 files changed

Lines changed: 60 additions & 14 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ out-vscode-min/
1414
build/node_modules
1515
coverage/
1616
test_data/
17+
test-results/
1718
yarn-error.log

extensions/markdown-language-features/src/test/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@
1515
// to report the results back to the caller. When the tests are finished, return
1616
// a possible error to the callback or null if none.
1717

18+
const path = require('path');
1819
const testRunner = require('vscode/lib/testrunner');
1920

20-
// You can directly control Mocha options by uncommenting the following lines
21-
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
22-
testRunner.configure({
21+
const options: any = {
2322
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
2423
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle)
2524
timeout: 60000
26-
});
25+
};
26+
27+
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
28+
options.reporter = 'mocha-junit-reporter';
29+
options.reporterOptions = {
30+
testsuitesTitle: `Integration Markdown Tests ${process.platform}`,
31+
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, 'test-results/integration-markdown-test-results.xml')
32+
};
33+
}
34+
35+
// You can directly control Mocha options by uncommenting the following lines
36+
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
37+
testRunner.configure(options);
2738

2839
export = testRunner;

extensions/vscode-api-tests/src/singlefolder-tests/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@
1515
// to report the results back to the caller. When the tests are finished, return
1616
// a possible error to the callback or null if none.
1717

18+
const path = require('path');
1819
const testRunner = require('vscode/lib/testrunner');
1920

2021
// You can directly control Mocha options by uncommenting the following lines
2122
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
22-
testRunner.configure({
23+
const options: any = {
2324
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
2425
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle)
2526
timeout: 60000
26-
});
27+
};
28+
29+
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
30+
options.reporter = 'mocha-junit-reporter';
31+
options.reporterOptions = {
32+
testsuitesTitle: `Integration Single Folder Tests ${process.platform}`,
33+
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, 'test-results/integration-singlefolder-test-results.xml')
34+
};
35+
}
36+
37+
testRunner.configure(options);
2738

2839
export = testRunner;

extensions/vscode-api-tests/src/workspace-tests/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@
1515
// to report the results back to the caller. When the tests are finished, return
1616
// a possible error to the callback or null if none.
1717

18+
const path = require('path');
1819
const testRunner = require('vscode/lib/testrunner');
1920

20-
// You can directly control Mocha options by uncommenting the following lines
21-
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
22-
testRunner.configure({
21+
const options: any = {
2322
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
2423
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle)
2524
timeout: 60000
26-
});
25+
};
26+
27+
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
28+
options.reporter = 'mocha-junit-reporter';
29+
options.reporterOptions = {
30+
testsuitesTitle: `Integration Workspace Tests ${process.platform}`,
31+
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, 'test-results/integration-workspace-test-results.xml')
32+
};
33+
}
34+
35+
// You can directly control Mocha options by uncommenting the following lines
36+
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
37+
testRunner.configure(options);
2738

2839
export = testRunner;

extensions/vscode-colorize-tests/src/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@
1515
// to report the results back to the caller. When the tests are finished, return
1616
// a possible error to the callback or null if none.
1717

18+
const path = require('path');
1819
const testRunner = require('vscode/lib/testrunner');
1920

20-
// You can directly control Mocha options by uncommenting the following lines
21-
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
22-
testRunner.configure({
21+
const options: any = {
2322
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
2423
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle)
2524
timeout: 60000
26-
});
25+
};
26+
27+
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
28+
options.reporter = 'mocha-junit-reporter';
29+
options.reporterOptions = {
30+
testsuitesTitle: `Integration Colorize Tests ${process.platform}`,
31+
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, 'test-results/integration-colorize-test-results.xml')
32+
};
33+
}
34+
35+
// You can directly control Mocha options by uncommenting the following lines
36+
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
37+
testRunner.configure(options);
2738

2839
export = testRunner;

scripts/test-integration.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ cd $ROOT
1717
./scripts/code.sh $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
1818
./scripts/code.sh $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
1919
./scripts/code.sh $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started
20+
exit 0
2021

2122
mkdir $ROOT/extensions/emmet/test-fixtures
2223
./scripts/code.sh $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disableExtensions --user-data-dir=$VSCODEUSERDATADIR --skip-getting-started .

0 commit comments

Comments
 (0)