Skip to content

Commit 039e562

Browse files
authored
Ensure smoke tests fail CI (#6998)
1 parent 85ea1b5 commit 039e562

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

src/test/smokeTest.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import { EXTENSION_ROOT_DIR_FOR_TESTS, SMOKE_TEST_EXTENSIONS_DIR } from './const
1717

1818
class TestRunner {
1919
public async start() {
20+
console.log('Start Test Runner');
2021
await this.enableLanguageServer(true);
2122
await this.extractLatestExtension(SMOKE_TEST_EXTENSIONS_DIR);
2223
await this.launchSmokeTests();
2324
}
24-
private async launchSmokeTests() {
25+
private async launchSmokeTests() {
2526
const env: Record<string, {}> = {
2627
VSC_PYTHON_SMOKE_TEST: '1',
2728
CODE_EXTENSIONS_PATH: SMOKE_TEST_EXTENSIONS_DIR
@@ -34,10 +35,12 @@ class TestRunner {
3435
await fs.ensureDir(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', '.vscode'));
3536
await fs.writeFile(path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', '.vscode', 'settings.json'), settings);
3637
}
37-
private async launchTest(customEnvVars: Record<string, {}>) {
38+
private async launchTest(customEnvVars: Record<string, {}>) {
39+
console.log('Launc tests in test runner');
3840
await new Promise((resolve, reject) => {
3941
const env: Record<string, {}> = {
4042
TEST_FILES_SUFFIX: 'smoke.test',
43+
IS_SMOKE_TEST: 'true',
4144
CODE_TESTS_WORKSPACE: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests'),
4245
...process.env,
4346
...customEnvVars
@@ -46,7 +49,8 @@ class TestRunner {
4649
proc.stdout.pipe(process.stdout);
4750
proc.stderr.pipe(process.stderr);
4851
proc.on('error', reject);
49-
proc.on('close', code => {
52+
proc.on('exit', code => {
53+
console.log(`Tests Exited with code ${code}`);
5054
if (code === 0) {
5155
resolve();
5256
} else {
@@ -57,7 +61,7 @@ class TestRunner {
5761
}
5862

5963
private async extractLatestExtension(targetDir: string): Promise<void> {
60-
const extensionFile = await new Promise<string>((resolve, reject) => glob('*.vsix', (ex, files) => ex ? reject(ex) : resolve(files[0])));
64+
const extensionFile = await new Promise<string>((resolve, reject) => glob('*.vsix', (ex, files) => (ex ? reject(ex) : resolve(files[0]))));
6165
await unzip(extensionFile, targetDir);
6266
}
6367
}

src/test/standardTest.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ function start() {
1717
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
1818
launchArgs: [workspacePath],
1919
version: 'stable'
20-
}).catch(console.error);
20+
}).catch(ex => {
21+
console.error('End Standard tests (with errors)');
22+
console.error(ex);
23+
if (process.env.IS_SMOKE_TEST) {
24+
process.exit(1);
25+
}
26+
});
2127
}
2228
start();

0 commit comments

Comments
 (0)