diff options
author | Gar <gar+gh@danger.computer> | 2022-07-28 00:04:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-28 00:04:53 +0300 |
commit | 0e3660eb39bd12a25517d745701bf841811b4623 (patch) | |
tree | 39d2de07a468e4a7a9771bc50ae29a605862f01f /test | |
parent | 77bf2e10236b72613101ac21d151f5974240f3aa (diff) |
fix(init): allow for spec on scope-only arg (#5206)
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/commands/init.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/lib/commands/init.js b/test/lib/commands/init.js index 32816adbc..e7b273934 100644 --- a/test/lib/commands/init.js +++ b/test/lib/commands/init.js @@ -136,6 +136,44 @@ t.test('npm init @scope/name', async t => { await init.exec(['@npmcli/something']) }) +t.test('npm init @scope@spec', async t => { + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../../lib/commands/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['@npmcli/create@foo'], + 'should npx with scoped packages' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) + await init.exec(['@npmcli@foo']) +}) + +t.test('npm init @scope/name@spec', async t => { + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../../lib/commands/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['@npmcli/create-something@foo'], + 'should npx with scoped packages' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) + await init.exec(['@npmcli/something@foo']) +}) + t.test('npm init git spec', async t => { t.plan(1) npm.localPrefix = t.testdir({}) |