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
add tests for NpmUtilities.getExecOpts() #663
Conversation
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.
A few minor nits, but thanks again for tackling this!
src/NpmUtilities.js
Outdated
opts.env = {npm_config_registry: registry}; | ||
opts.env = Object.assign({}, process.env, { | ||
npm_config_registry: registry, | ||
}); |
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 was playing with NpmUtilities.getExecOpts()
locally during the contentious rebasing process yesterday, and I could have sworn I added it here, too. (technically ChildProcessUtilities.spawn()
in this method, but same diff as far as the opts
go). I think we should take the opportunity to reuse the new getExecOpts()
method:
const opts = NpmUtilities.getExecOpts(directory, registry);
opts.stdio = ["ignore", "pipe", "pipe"];
Like all good refactorings, the rest of your (much appreciated!) tests won't need to be further modified. :)
(we can leave the other exec opts cwd
and env
in this file alone for now, they're not aware of the registry for the moment)
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.
Sure, will do in the evening!
test/NpmUtilities.js
Outdated
|
||
it("should handle environment variables properly", () => { | ||
process.env = mockEnv; | ||
const want = {cwd: "test_dir", env: Object.assign({}, mockEnv, {npm_config_registry: "https://my-secure-registry/npm"})}; |
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.
Let's spread this across multiple lines for readability, please.
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.
Sorry I forgot about this!
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.