Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
test: ensure npm init forwards arguments (#20372)
PR-URL: #20372
Credit: @jdalton
Reviewed-By: @zkat
  • Loading branch information
jdalton authored and zkat committed Apr 20, 2018
1 parent 9d5d0a1 commit ed81d1426776bcac47492cabef43f65e1d4ab536
Showing with 29 additions and 0 deletions.
  1. +29 −0 test/tap/init-create.js
@@ -59,3 +59,32 @@ test('npm init with scoped packages', function (t) {
t.end()
})
})

test('npm init forwards arguments', function (t) {
var libnpxMock = function () {
return Promise.resolve()
}

npm.load({ loglevel: 'silent' }, function () {
var origArgv = process.argv
var init = requireInject('../../lib/init', {
'libnpx': libnpxMock
})

libnpxMock.parseArgs = function (argv) {
process.argv = origArgv
t.same(argv.slice(4), ['a', 'b', 'c'])
}
process.argv = [
process.argv0,
'NPM_CLI_PATH',
'init',
'pkg-name',
'a', 'b', 'c'
]

init(['pkg-name'], function () {})

t.end()
})
})

0 comments on commit ed81d14

Please sign in to comment.