import * as path from 'path' ; import { runTests } from 'vscode-test' ; import * as cp from 'child_process' ; import { downloadAndUnzipVSCode , resolveCliPathFromVSCodeExecutablePath } from 'vscode-test' ; async function main ( ) { try { let version = 'stable' ; if ( process . env . VERSION ) { version = process . env . VERSION ; } process . env . MAP_OPSTOOLS_URL = process . argv [ 2 ] ; process . env . MAP_OPSTOOLS_KEY = process . argv [ 3 ] ; process . env . MAP_OPSTOOLS_SECRET = process . argv [ 4 ] ; process . env . MAP_OPSTOOLS_SAAS_API_KEY = process . argv [ 5 ] ; const extensionDevelopmentPath = path . resolve ( __dirname , '..' , '..' ) ; const extensionTestsPath = path . resolve ( __dirname ) ; const workspacePath = path . resolve ( __dirname , '..' , '..' , 'cucumber' , 'data' , 'cucumber.code-workspace' ) ; const vscodeExecutablePath = await downloadAndUnzipVSCode ( version ) ; const cliPath = resolveCliPathFromVSCodeExecutablePath ( vscodeExecutablePath ) ; cp . spawnSync ( cliPath , [ '--install-extension' , 'oshri6688.javascript-test-runner' ] , { encoding : 'utf-8' , stdio : 'inherit' } ) ; await runTests ( { extensionDevelopmentPath , extensionTestsPath , launchArgs : [ workspacePath ] , version : version } ) ; } catch ( err ) { console . error ( 'Failed to run tests' , err ) ; process . exit ( 1 ) ; } } main ( ) ;