Fix swc test path from node_modules (#66047)

Noticed while testing turbopack version of tests that we weren't loading
the correct swc binary since this path wasn't absolute and was just the
relative path in `node_modules`.

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
This commit is contained in:
JJ Kasper 2024-05-21 11:01:35 -07:00 committed by GitHub
parent 93303b41b9
commit 1ad97e42f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,9 +100,18 @@ async function createNextInstall({
const swcDirectory = fs
.readdirSync(path.join(origRepoDir, 'node_modules/@next'))
.find((directory) => directory.startsWith('swc-'))
process.env.NEXT_TEST_NATIVE_DIR = swcDirectory
process.env.NEXT_TEST_NATIVE_DIR = path.join(
origRepoDir,
'node_modules/@next',
swcDirectory
)
}
// log for clarity of which version we're using
require('console').log({
swcDirectory: process.env.NEXT_TEST_NATIVE_DIR,
})
pkgPaths = await rootSpan
.traceChild('linkPackages')
.traceAsyncFn((span) =>