Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions test/lib/create-next-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ const { linkPackages } =
const PREFER_OFFLINE = process.env.NEXT_TEST_PREFER_OFFLINE === '1'
const useRspack = process.env.NEXT_TEST_USE_RSPACK === '1'

function createTempId() {
// Windows path length limits can cause Turbopack to fail resolving packages
// from very deep pnpm virtual-store paths. Keep temp folder names short.
const bytes = process.platform === 'win32' ? 16 : 32
return randomBytes(bytes).toString('hex')
}

async function installDependencies(cwd, tmpDir) {
const args = [
'install',
Expand Down Expand Up @@ -62,7 +69,7 @@ async function createNextInstall({
const origRepoDir = path.join(__dirname, '../../')
const installDir = path.join(
tmpDir,
`next-install-${randomBytes(32).toString('hex')}`,
`next-install-${createTempId()}`,
subDir
)
let tmpRepoDir
Expand All @@ -78,7 +85,7 @@ async function createNextInstall({
} else {
tmpRepoDir = path.join(
tmpDir,
`next-repo-${randomBytes(32).toString('hex')}`,
`next-repo-${createTempId()}`,
subDir
)
require('console').log('Creating temp repo dir', tmpRepoDir)
Expand Down
Loading