Repository navigation
policy tests fail if there is a package.json in parent directories #35600
Description
Activity
@jasnell this is intentional since that is how policies work, the CJS/ESM loaders crawl up to find "type" from package.json files and if it finds one that isn't allowed it fails. Is there some issue that needs to be fixed?
Yes, I get that, it's just unexpected for the test suite to fail due to some factor completely outside of the project repo. Ideally there would be a way of sandboxing it or limiting the search path... or, if that's not possible, to provide a better error that describes why it's failing.
we could also just put a well known package.json in the test directory
we could also just put a well known package.json in the test directory
Good idea. I'm on it.
Actually, I don't understand what needs to be changed to make it work, feel free to pick it up 😄 .
- addedpolicyHistorical issues and PRs related to the removed policy-manifest feature.Historical issues and PRs related to the removed policy-manifest feature.testIssues and PRs related to Node.js core tests and test infrastructure.Issues and PRs related to Node.js core tests and test infrastructure.
on Oct 16, 2020 - added a commit that references this issue
on Nov 9, 2020 - added a commit that references this issue
on Apr 23, 2021 - added a commit that references this issue
on Apr 29, 2021 - added a commit that references this issue
on May 22, 2026
Just opening this so it's not forgotten.... Policy tests can fail if there is a package.json in the parent path of the local node.js repo
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
What is the expected behavior?
What do you see instead?
Additional information