import * as cp from "child_process" ; import * as os from "os" ; import * as path from "path" ; import { downloadAndUnzipVSCode , resolveCliPathFromVSCodeExecutablePath , runTests } from "vscode-test" ; async function main ( ) { try { const vscodeExecutablePath = await downloadAndUnzipVSCode ( ) ; const cliPath = resolveCliPathFromVSCodeExecutablePath ( vscodeExecutablePath ) ; cp . spawnSync ( cliPath , [ "--install-extension" , "redhat.java" ] , { encoding : "utf-8" , stdio : "inherit" , } ) ; const extensionDevelopmentPath = path . resolve ( __dirname , "../../" ) ; await runTests ( { vscodeExecutablePath , extensionDevelopmentPath , extensionTestsPath : path . resolve ( __dirname , "./suite" ) , launchArgs : [ path . join ( __dirname , ".." , ".." , "test" , "java9" ) , "--disable-workspace-trust" , ] , } ) ; await runTests ( { vscodeExecutablePath , extensionDevelopmentPath , extensionTestsPath : path . resolve ( __dirname , "./simple-suite" ) , launchArgs : [ path . join ( __dirname , ".." , ".." , "test" , "simple" ) , "--disable-workspace-trust" , ] , } ) ; await runTests ( { vscodeExecutablePath , extensionDevelopmentPath , extensionTestsPath : path . resolve ( __dirname , "./maven-suite" ) , launchArgs : [ path . join ( __dirname , ".." , ".." , "test" , "maven" ) , "--disable-workspace-trust" , ] , } ) ; await runTests ( { vscodeExecutablePath , extensionDevelopmentPath , extensionTestsPath : path . resolve ( __dirname , "./gradle-suite" ) , launchArgs : [ path . join ( __dirname , ".." , ".." , "test" , "gradle" ) , "--disable-workspace-trust" , ] , } ) ; await runTests ( { vscodeExecutablePath , extensionDevelopmentPath , extensionTestsPath : path . resolve ( __dirname , "./invisible-suite" ) , launchArgs : [ path . join ( __dirname , ".." , ".." , "test" , "invisible" ) , "--disable-workspace-trust" , ] , } ) ; process . exit ( 0 ) ; } catch ( err ) { process . stdout . write ( `${ err }${ os . EOL }` ) ; process . exit ( 1 ) ; } } main ( ) ;