-
-
Notifications
You must be signed in to change notification settings - Fork 298
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 2FA prompt when the package exists #505
Conversation
Done |
@sindresorhus Good. And I'd also like the other two approved pull requests (#495, #497) can be merged first. Note that this PR includes changes of #497 now. |
@chinesedfan Note that I merged #497, and reviewed #495. |
test('should not enable 2fa if the package exists', async t => { | ||
const enable2faStub = sinon.stub(); | ||
const np = proxyquire('../source', { | ||
del: sinon.stub(), |
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.
Why do we need all of these stubs? Can't we run np with --yolo
and remove the need for most of them? While I do want the tests to reflect actual stability, I think it's more important in this case to be as specific as possible, and only test what we need to verify - that we skip enabling 2FA when not needed to do so.
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.
--yolo
can only remove del
and execa
. I used to want to use --preview
, but it would skip the enable2fa task totally. And I don't think adding stubs will affect the correctness of the test case. Maybe because I consider it as unit test, while you treat it as end-to-end test.
Fixes regressions in #490.
publish
is false.options.exists
now.Can we merge #399 first? It will be easier to write tests.