• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 26431083026

26 May 2026 03:47AM UTC coverage: 92.791% (+0.004%) from 92.787%
26431083026

push

github

web-flow
fix(js): include workspace member node_modules in install sandbox (#23342)

# Problem

In a nodejs workspace, each project of the workspace can have its own
`node_modules` directory that is populated during installation.
Previously, pants was capturing the project's workspace and the
top-level workspace but not sibling or descendent projects. This caused
certain operations to fail, such as `tsc --build` on a pnpm workspace
project since a pnpm project doesn't hoist member deps to the root by
default. Outside of pnpm, there are reports of this causing problems
with yarn/npm projects where a version conflict prevents hoisting.

# Solution

In `node_modules_directories`, the install sandbox now captures every
workspace member's `node_modules/`, not just the build target's.

Note: the new behavior only impacts the install path ( when
`self.package` is set). Lockfile generation's codepath
(via`NodeJsProjectEnvironment.from_root()`) doesn't set `self.package`
and keeps the "root only" behavior. Dropping the `if self.package` check
would align with the approach from #23264, but I left out that change to
minimize the scope. I added a test to demonstrate this behavior.

# AI Disclosure

Claude Code was used to diagnose the problem, write the fix with my
input, and write the regression tests

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

93062 of 100292 relevant lines covered (92.79%)

4.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.0
/src/python/pants/backend/javascript/nodejs_project_environment.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc