-
Notifications
You must be signed in to change notification settings - Fork 152
fix: Change npm bin to npm root #407
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| from pathlib import Path | ||
| from unittest import TestCase | ||
| from unittest.mock import ANY | ||
|
|
||
|
|
@@ -65,7 +66,7 @@ def test_workflow_sets_up_npm_actions_with_bundler_if_manifest_requests_it(self) | |
|
|
||
| def test_sets_up_esbuild_search_path_from_npm_bin(self): | ||
|
|
||
| self.popen.out = b"project/bin" | ||
| self.popen.out = b"project/" | ||
|
|
||
| workflow = NodejsNpmEsbuildWorkflow( | ||
| "source", | ||
|
|
@@ -76,15 +77,15 @@ def test_sets_up_esbuild_search_path_from_npm_bin(self): | |
| experimental_flags=[], | ||
| ) | ||
|
|
||
| self.osutils.popen.assert_called_with(["npm", "bin"], stdout="PIPE", stderr="PIPE", cwd="scratch_dir") | ||
| self.osutils.popen.assert_called_with(["npm", "root"], stdout="PIPE", stderr="PIPE", cwd="scratch_dir") | ||
| esbuild = workflow.actions[2]._subprocess_esbuild | ||
|
|
||
| self.assertIsInstance(esbuild, SubprocessEsbuild) | ||
| self.assertEqual(esbuild.executable_search_paths, ["project/bin"]) | ||
| self.assertEqual(esbuild.executable_search_paths, [str(Path("project/.bin"))]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested running I think it will not make a difference in our case, but I am sharing that with you so may be I am missing any thing
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that there are some discrepancies, do we have integration tests that will catch any of these possible errors? Or these differences are just fine since all integration tests have passed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case it shouldn't make a difference. Our integration test cases should already cover this case, we just need to run them using npm 9 in our test jobs. |
||
|
|
||
| def test_sets_up_esbuild_search_path_with_workflow_executable_search_paths_after_npm_bin(self): | ||
|
|
||
| self.popen.out = b"project/bin" | ||
| self.popen.out = b"project" | ||
|
|
||
| workflow = NodejsNpmEsbuildWorkflow( | ||
| "source", | ||
|
|
@@ -96,10 +97,10 @@ def test_sets_up_esbuild_search_path_with_workflow_executable_search_paths_after | |
| experimental_flags=[], | ||
| ) | ||
|
|
||
| self.osutils.popen.assert_called_with(["npm", "bin"], stdout="PIPE", stderr="PIPE", cwd="scratch_dir") | ||
| self.osutils.popen.assert_called_with(["npm", "root"], stdout="PIPE", stderr="PIPE", cwd="scratch_dir") | ||
| esbuild = workflow.actions[2]._subprocess_esbuild | ||
| self.assertIsInstance(esbuild, SubprocessEsbuild) | ||
| self.assertEqual(esbuild.executable_search_paths, ["project/bin", "other/bin"]) | ||
| self.assertEqual(esbuild.executable_search_paths, [str(Path("project/.bin")), "other/bin"]) | ||
|
|
||
| def test_workflow_uses_npm_ci_if_lockfile_exists(self): | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can we make sure the
npm rootcommand is available in all supported npm versions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked in the documentation which versions this command is supported in https://docs.npmjs.com/cli/v8/commands/npm-root. Should be all the same versions as
npm bin+ npm 9.