| 27 | await this.launchTest(env); |
| 28 | } |
| 29 | private async launchTest(customEnvVars: Record<string, {}>) { |
| 30 | await new Promise<void>((resolve, reject) => { |
| 31 | const env: Record<string, string> = { |
| 32 | TEST_FILES_SUFFIX: 'smoke.test*', |
| 33 | IS_SMOKE_TEST: 'true', |
| 34 | CODE_TESTS_WORKSPACE: path.join( |
| 35 | EXTENSION_ROOT_DIR_FOR_TESTS, |
| 36 | 'src', |
| 37 | 'test', |
| 38 | 'testMultiRootWkspc', |
| 39 | 'smokeTests' |
| 40 | ), |
| 41 | ...process.env, |
| 42 | ...customEnvVars |
| 43 | }; |
| 44 | const proc = spawn('node', [path.join(__dirname, 'standardTest.node.js')], { |
| 45 | cwd: EXTENSION_ROOT_DIR_FOR_TESTS, |
| 46 | env, |
| 47 | stdio: 'inherit' |
| 48 | }); |
| 49 | proc.on('error', reject); |
| 50 | proc.on('exit', (code) => { |
| 51 | console.log(`Tests Exited with code ${code}`); |
| 52 | if (code === 0) { |
| 53 | resolve(); |
| 54 | } else { |
| 55 | reject(`Failed with code ${code}.`); |
| 56 | } |
| 57 | }); |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | private async extractLatestExtension(targetDir: string): Promise<void> { |
| 62 | if (process.env.VSIX_NAME) { |