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

add tests for NpmUtilities.getExecOpts() #663

Merged
merged 3 commits into from Mar 14, 2017

Conversation

noherczeg
Copy link
Contributor

No description provided.

Copy link
Member

@evocateur evocateur left a 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!

opts.env = {npm_config_registry: registry};
opts.env = Object.assign({}, process.env, {
npm_config_registry: registry,
});
Copy link
Member

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)

Copy link
Contributor Author

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!


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"})};
Copy link
Member

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.

Copy link
Member

@evocateur evocateur left a 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!

@evocateur evocateur changed the title registry flag fix with additional tests add tests for NpmUtilities.getExecOpts() Mar 14, 2017
@evocateur evocateur merged commit 8715393 into lerna:master Mar 14, 2017
@evocateur evocateur modified the milestone: v2.0.0 Mar 15, 2017
@lock
Copy link

lock bot commented Dec 27, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants