-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix(npm) pass npm context everywhere #2772
Conversation
This is built off of #2759 but that one should be long since landed by the time this is done. |
b879719
to
333d704
Compare
|
||
if (!cmd) | ||
throw UsageError('Subcommand is required.') | ||
exec (args, cb) { |
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.
It looks like you're heading in this direction already, but pretty please can we ditch the callbacks entirely? 😆 I'd love to see this.access
just be this.exec()
, and have npm know how to handle that.
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.
That change was left out of this PR because of the amount of testing changes it would require. This PR is mostly code change, with minimal test changes.
Making this function async would be a minimal code change, and a larger test change. It'd be much easier than THIS PR, but still needs to be its own thing.
00ccefd
to
876a231
Compare
7dcc94f
to
5bd0d30
Compare
c3b9d27
to
cbea9bc
Compare
Instead of files randomly requiring the npm singleton, we pass it where it needs to go so that tests don't need to do so much require mocking everywhere.
Instead of continuing down the path of "Just add a function that wraps another function and adds something new to its context," commands are now proper objects.
Usage output is more correct now, that bugfix had to be in here to get things to work.
open-url had a bug where it was never handling its happy-path callback. That bug went away due to refactoring.
Tests were also added that were missing for install-ci-test and install-test.
Other minor bugfixes like how open-url was not ever handling its happy-path callback had to be fixed.
We are going to have to find a better solution for coverage on the usage and completion functions, when they are accessed through
npm.commands.x
they do not count for coverage, and that is the only way we should ultimately be trying to access them once we have proper tests.Fixes: npm/statusboard#124