import fs from 'fs-extra' ; import path from 'path' ; import { runTests } from 'vscode-test' ; import { TestOptions } from 'vscode-test/out/runTest' ; let targetResourcesDir = path . join ( __dirname , 'resources' ) ; /**
 * Prepare the VS Code test environment and run the integration tests.
 */ async function main ( ) { try { const extensionDevelopmentPath = path . join ( __dirname , '..' , '..' ) ; const extensionTestsPath = path . join ( __dirname , 'index' ) ; await runTests ( { extensionDevelopmentPath , extensionTestsPath , launchArgs : [ '--disable-extensions' , '-n' , targetResourcesDir ] } as TestOptions ) ; } catch ( err ) { console . error ( 'Failed to run tests' , err ) ; process . exit ( 1 ) ; } } /**
 * Copy 'src/test/resources' directory to 'out/test/resources'
 */ async function createResourcesDir ( ) { const resourcesDir = path . join ( __dirname , '..' , '..' , 'src' , 'test' , 'resources' ) ; console . log ( 'Deleting if exist: ' + targetResourcesDir ) ; fs . removeSync ( targetResourcesDir ) ; console . log ( 'Copying ' + resourcesDir + ' to ' + targetResourcesDir ) ; fs . copySync ( resourcesDir , targetResourcesDir ) ; } createResourcesDir ( ) ; main ( ) ;