@@ -90,6 +90,8 @@ function selectShard<T>(items: T[], index: number, total: number): T[] {
9090 return items . slice ( start , start + chunkSize ) ;
9191}
9292
93+ const NPM_GLOBAL_PREFIX_DIR = 'npm-global-lib-for-snap-tests' ;
94+
9395export async function snapTest ( ) {
9496 const { positionals, values } = parseArgs ( {
9597 allowPositionals : true ,
@@ -113,7 +115,7 @@ export async function snapTest() {
113115 fs . mkdirSync ( tempTmpDir , { recursive : true } ) ;
114116 // Pre-create the npm global prefix directory so tests using npm global
115117 // operations (link, outdated -g, etc.) don't fail with ENOENT.
116- fs . mkdirSync ( path . join ( tempTmpDir , 'npm-global-lib-for-snap-tests' , 'lib' ) , { recursive : true } ) ;
118+ fs . mkdirSync ( path . join ( tempTmpDir , NPM_GLOBAL_PREFIX_DIR , 'lib' ) , { recursive : true } ) ;
117119
118120 // Clean up stale .node-version and package.json in the system temp directory.
119121 // vite-plus walks up the directory tree to resolve Node.js versions, so leftover
@@ -359,7 +361,7 @@ async function runTestCase(name: string, tempTmpDir: string, casesDir: string, b
359361 // Skip `vp install` inside `vp migrate` — snap tests don't need real installs
360362 VP_SKIP_INSTALL : '1' ,
361363 // make sure npm install global packages to the temporary directory
362- NPM_CONFIG_PREFIX : path . join ( tempTmpDir , 'npm-global-lib-for-snap-tests' ) ,
364+ NPM_CONFIG_PREFIX : path . join ( tempTmpDir , NPM_GLOBAL_PREFIX_DIR ) ,
363365
364366 // A test case can override/unset environment variables above.
365367 // For example, VP_CLI_TEST/CI can be unset to test the real-world outputs.
0 commit comments