@@ -4,6 +4,7 @@ import colors from 'ansi-colors';
44import glob from 'fast-glob' ;
55import * as path from 'node:path' ;
66import * as fs from 'node:fs' ;
7+ import { rm } from 'node:fs/promises' ;
78import { getGlobalVariable , setGlobalVariable } from './e2e/utils/env' ;
89import { gitClean } from './e2e/utils/git' ;
910import { createNpmRegistry } from './e2e/utils/registry' ;
@@ -13,7 +14,7 @@ import { findFreePort } from './e2e/utils/network';
1314import { extractFile } from './e2e/utils/tar' ;
1415import { realpathSync } from 'node:fs' ;
1516import { PkgInfo } from './e2e/utils/packages' ;
16- import { rm } from 'node:fs/promises ' ;
17+ import { getTestProjectDir } from './e2e/utils/project ' ;
1718
1819Error . stackTraceLimit = Infinity ;
1920
@@ -271,6 +272,14 @@ Promise.all([findFreePort(), findFreePort(), findPackageTars()])
271272 } finally {
272273 registryProcess . kill ( ) ;
273274 secureRegistryProcess . kill ( ) ;
275+
276+ await rm ( getGlobalVariable ( 'projects-root' ) , {
277+ recursive : true ,
278+ force : true ,
279+ maxRetries : 3 ,
280+ } ) . catch ( ( ) => {
281+ // If this fails it is not fatal.
282+ } ) ;
274283 }
275284 } )
276285 . catch ( ( err ) => {
@@ -334,7 +343,7 @@ function runInitializer(absoluteName: string): Promise<void> {
334343 * Run a file from the main 'test-project' directory in a subprocess via launchTestProcess().
335344 */
336345async function runTest ( absoluteName : string ) : Promise < void > {
337- process . chdir ( join ( getGlobalVariable ( 'projects-root' ) , 'test-project' ) ) ;
346+ process . chdir ( getTestProjectDir ( ) ) ;
338347
339348 await launchTestProcess ( absoluteName ) ;
340349 await cleanTestProject ( ) ;
@@ -343,7 +352,7 @@ async function runTest(absoluteName: string): Promise<void> {
343352async function cleanTestProject ( ) {
344353 await gitClean ( ) ;
345354
346- const testProject = join ( getGlobalVariable ( 'projects-root' ) , 'test-project' ) ;
355+ const testProject = getTestProjectDir ( ) ;
347356
348357 // Note: Dist directory is not cleared between tests, as `git clean`
349358 // doesn't delete it.
0 commit comments