diff options
Diffstat (limited to 'test/tap/init-interrupt.js')
-rw-r--r-- | test/tap/init-interrupt.js | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/test/tap/init-interrupt.js b/test/tap/init-interrupt.js index 962ab7244..2e85a5d1b 100644 --- a/test/tap/init-interrupt.js +++ b/test/tap/init-interrupt.js @@ -1,52 +1,52 @@ -// if "npm init" is interrupted with ^C, don't report -// "init written successfully" -var test = require("tap").test -var path = require("path") -var osenv = require("osenv") -var rimraf = require("rimraf") -var npmlog = require("npmlog") -var requireInject = require("require-inject") +// if 'npm init' is interrupted with ^C, don't report +// 'init written successfully' +var test = require('tap').test +var path = require('path') +var osenv = require('osenv') +var rimraf = require('rimraf') +var npmlog = require('npmlog') +var requireInject = require('require-inject') -var npm = require("../../lib/npm.js") +var npm = require('../../lib/npm.js') -var PKG_DIR = path.resolve(__dirname, "init-interrupt") +var PKG_DIR = path.resolve(__dirname, 'init-interrupt') -test("setup", function (t) { +test('setup', function (t) { cleanup() t.end() }) -test("issue #6684 remove confusing message", function (t) { +test('issue #6684 remove confusing message', function (t) { var initJsonMock = function (dir, input, config, cb) { process.nextTick(function () { - cb({message : "canceled"}) + cb({ message: 'canceled' }) }) } initJsonMock.yes = function () { return true } - npm.load({loglevel : "silent"}, function () { - var log = "" - var init = requireInject("../../lib/init", { - "init-package-json": initJsonMock + npm.load({ loglevel: 'silent' }, function () { + var log = '' + var init = requireInject('../../lib/init', { + 'init-package-json': initJsonMock }) // capture log messages - npmlog.on("log", function (chunk) { log += chunk.message + "\n" } ) + npmlog.on('log', function (chunk) { log += chunk.message + '\n' }) init([], function (err, code) { - t.ifError(err, "init ran successfully") - t.notOk(code, "exited without issue") - t.notSimilar(log, /written successfully/, "no success message written") - t.similar(log, /canceled/, "alerted that init was canceled") + t.ifError(err, 'init ran successfully') + t.notOk(code, 'exited without issue') + t.notSimilar(log, /written successfully/, 'no success message written') + t.similar(log, /canceled/, 'alerted that init was canceled') t.end() }) }) }) -test("cleanup", function (t) { +test('cleanup', function (t) { cleanup() t.end() |