Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
test: ensure npm init forwards arguments (#20372)
Browse files Browse the repository at this point in the history
PR-URL: #20372
Credit: @jdalton
Reviewed-By: @zkat
  • Loading branch information
jdalton authored and iarna committed May 5, 2018
1 parent 1b535cb commit f03b45f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/tap/init-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 f03b45f

Please sign in to comment.