npm/npm — pull request #6691 by smikes (2014-11-12 21:51:50+00:00)
Title: Report success after handling error fixes #6684

Left this unsquashed so you can see it as two separate commits:

first the unit test
- creates a mock `init-package-json` which just immediately cancels (using @iarna 's excellent `requireInject()` module, thanks!)
- calls init(), collecting log messages
- asserts that log message should contain 'canceled' but not 'written successfully'

This fails when run in the npm@2.1.8 repository.

The fix is just to move the log message about writing after the error handler. Writing the repro case was much harder than fixing the bug