You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
policy tests fail if there is a package.json in parent directories #35600
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
Error [ERR_MANIFEST_ASSERT_INTEGRITY]: The content of "file:///home/james/package.json" does not match the expected integrity. The resource was not found in the policy.
at new NodeError (node:internal/errors:258:15)
at Manifest.assertIntegrity (node:internal/policy/manifest:532:19)
at Object.read (node:internal/modules/package_json_reader:34:16)
at readPackage (node:internal/modules/cjs/loader:259:36)
at readPackageScope (node:internal/modules/cjs/loader:292:19)
at shouldUseESMLoader (node:internal/modules/run_main:36:15)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:67:24)
at node:internal/main/run_main_module:17:47 {
code: 'ERR_MANIFEST_ASSERT_INTEGRITY'
}
at Object.<anonymous> (/home/james/node/node/test/parallel/test-policy-integrity-flag.js:64:10)
at Module._compile (node:internal/modules/cjs/loader:1072:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1101:10)
at Module.load (node:internal/modules/cjs/loader:937:32)
at Function.Module._load (node:internal/modules/cjs/loader:778:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47 {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: 1,
expected: 0,
operator: 'strictEqual'
}
Command: out/Release/node /home/james/node/node/test/parallel/test-policy-integrity-flag.js
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
@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.
Activity
bmeck commentedon Oct 12, 2020
@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?
jasnell commentedon Oct 12, 2020
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.
bmeck commentedon Oct 12, 2020
we could also just put a well known package.json in the test directory
targos commentedon Oct 13, 2020
Good idea. I'm on it.
targos commentedon Oct 13, 2020
Actually, I don't understand what needs to be changed to make it work, feel free to pick it up 😄 .
test: improve error message for policy failures
test: improve error message for policy failures
test: improve error message for policy failures
test: improve error message for policy failures
test: add ancestor package.json checks for tmpdir
test: add ancestor package.json checks for tmpdir
test: add ancestor package.json checks for tmpdir
test: add ancestor package.json checks for tmpdir
test: add ancestor package.json checks for tmpdir
test: improve error message for policy failures