Skip to content

Commit 20e327a

Browse files
test: shorten isolated install dir names on Windows
1 parent aba09f4 commit 20e327a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/lib/create-next-install.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ const { linkPackages } =
1010
const PREFER_OFFLINE = process.env.NEXT_TEST_PREFER_OFFLINE === '1'
1111
const useRspack = process.env.NEXT_TEST_USE_RSPACK === '1'
1212

13+
function createTempId() {
14+
// Windows path length limits can cause Turbopack to fail resolving packages
15+
// from very deep pnpm virtual-store paths. Keep temp folder names short.
16+
const bytes = process.platform === 'win32' ? 16 : 32
17+
return randomBytes(bytes).toString('hex')
18+
}
19+
1320
async function installDependencies(cwd, tmpDir) {
1421
const args = [
1522
'install',
@@ -62,7 +69,7 @@ async function createNextInstall({
6269
const origRepoDir = path.join(__dirname, '../../')
6370
const installDir = path.join(
6471
tmpDir,
65-
`next-install-${randomBytes(32).toString('hex')}`,
72+
`next-install-${createTempId()}`,
6673
subDir
6774
)
6875
let tmpRepoDir
@@ -78,7 +85,7 @@ async function createNextInstall({
7885
} else {
7986
tmpRepoDir = path.join(
8087
tmpDir,
81-
`next-repo-${randomBytes(32).toString('hex')}`,
88+
`next-repo-${createTempId()}`,
8289
subDir
8390
)
8491
require('console').log('Creating temp repo dir', tmpRepoDir)

0 commit comments

Comments
 (0)