import * as path from 'path' ; import * as fs from 'fs-extra' ; import { runTests } from 'vscode-test' ; import { extensionRootPath , tempRepoFolder } from './common' ; import { setupDefaultRepo } from './extension/repoSetup' ; async function main ( ) { try { const extensionDevelopmentPath = extensionRootPath ; const extensionTestsPath = path . resolve ( __dirname , './extension/testRunner' ) ; fs . mkdirpSync ( path . join ( tempRepoFolder , 'test_gitHistory' ) ) ; const testResultFailedFile = path . join ( tempRepoFolder , 'tests.failed' ) ; if ( fs . existsSync ( testResultFailedFile ) ) { fs . unlinkSync ( testResultFailedFile ) ; } await setupDefaultRepo ( ) ; await runTests ( { extensionDevelopmentPath , extensionTestsPath , launchArgs : [ path . join ( tempRepoFolder , 'test_gitHistory' ) , '--disable-extensions' ] , extensionTestsEnv : { IS_TEST_MODE : '1' } , } ) ; if ( fs . existsSync ( testResultFailedFile ) ) { console . error ( 'Failed to run tests' ) ; process . exit ( 1 ) ; } } catch ( err ) { console . error ( 'Failed to run tests' ) ; process . exit ( 1 ) ; } } main ( ) ;