fix: resolve jest-runner inside scoped package subdirectories

The recursive search in loop-runner.js wasn't entering package
directories inside scoped namespaces (e.g. @jest/core), so it couldn't
find jest-runner nested at @jest/core/node_modules/jest-runner.
This commit is contained in:
Kevin Turcios 2026-03-07 12:26:52 -06:00
parent 123f06084d
commit d9a329667e

View file

@ -82,11 +82,13 @@ function findJestRunnerRecursive(nodeModulesPath, maxDepth = 5) {
// Recurse into:
// - node_modules subdirectories
// - scoped packages (@org/pkg)
// - scoped packages (@org/pkg) and their children (e.g. @jest/core)
// - hidden directories (.pnpm, .yarn, etc.)
// - pnpm versioned directories (jest-runner@30.0.5)
const isInsideScopedDir = path.basename(dir).startsWith('@');
const shouldRecurse = entry.name === 'node_modules' ||
entry.name.startsWith('@') ||
isInsideScopedDir ||
entry.name === '.pnpm' || entry.name === '.yarn' ||
entry.name.startsWith('jest-runner@');