Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

policy tests fail if there is a package.json in parent directories #35600

Closed
jasnell opened this issue Oct 11, 2020 · 5 comments
Closed

policy tests fail if there is a package.json in parent directories #35600

jasnell opened this issue Oct 11, 2020 · 5 comments
Labels
policy Issues and PRs related to the policy subsystem. test Issues and PRs related to the tests.

Comments

@jasnell
Copy link
Member

jasnell commented Oct 11, 2020

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?

What is the expected behavior?

What do you see instead?

Additional information

@bmeck
Copy link
Member

bmeck commented 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
Copy link
Member Author

jasnell commented 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
Copy link
Member

bmeck commented Oct 12, 2020

we could also just put a well known package.json in the test directory

@targos
Copy link
Member

targos commented Oct 13, 2020

we could also just put a well known package.json in the test directory

Good idea. I'm on it.

@targos
Copy link
Member

targos commented Oct 13, 2020

Actually, I don't understand what needs to be changed to make it work, feel free to pick it up 😄 .

@watilde watilde added policy Issues and PRs related to the policy subsystem. test Issues and PRs related to the tests. labels Oct 16, 2020
@aduh95 aduh95 closed this as completed in 5b95f01 Nov 9, 2020
danielleadams pushed a commit that referenced this issue Nov 9, 2020
PR-URL: #35633
Fixes: #35600
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BethGriggs pushed a commit that referenced this issue Dec 9, 2020
PR-URL: #35633
Fixes: #35600
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BethGriggs pushed a commit that referenced this issue Dec 10, 2020
PR-URL: #35633
Fixes: #35600
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BethGriggs pushed a commit that referenced this issue Dec 15, 2020
PR-URL: #35633
Fixes: #35600
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Trott pushed a commit that referenced this issue Apr 23, 2021
Policy tests can fail if a `package.json` exists in any of the parent
directories above the test. The existing checks are done for the
ancestors of the test directory but some tests execute from the tmpdir.

PR-URL: #38285
Refs: #38088
Refs: #35600
Refs: #35633
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Apr 29, 2021
Policy tests can fail if a `package.json` exists in any of the parent
directories above the test. The existing checks are done for the
ancestors of the test directory but some tests execute from the tmpdir.

PR-URL: #38285
Refs: #38088
Refs: #35600
Refs: #35633
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue May 30, 2021
Policy tests can fail if a `package.json` exists in any of the parent
directories above the test. The existing checks are done for the
ancestors of the test directory but some tests execute from the tmpdir.

PR-URL: #38285
Refs: #38088
Refs: #35600
Refs: #35633
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Jun 5, 2021
Policy tests can fail if a `package.json` exists in any of the parent
directories above the test. The existing checks are done for the
ancestors of the test directory but some tests execute from the tmpdir.

PR-URL: #38285
Refs: #38088
Refs: #35600
Refs: #35633
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Jun 11, 2021
Policy tests can fail if a `package.json` exists in any of the parent
directories above the test. The existing checks are done for the
ancestors of the test directory but some tests execute from the tmpdir.

PR-URL: #38285
Refs: #38088
Refs: #35600
Refs: #35633
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
policy Issues and PRs related to the policy subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants