From 768187b90f2887fa12624e292f0aac988fdee13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Mon, 4 Feb 2019 10:01:58 -0800 Subject: [PATCH] access: ls-collaborators is ok with non-scoped Fixes: https://npm.community/t/npm-6-6-0-breaks-access-to-ls-collaborators/5101 --- lib/access.js | 2 +- test/tap/access.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/access.js b/lib/access.js index 4bb93fda1d0ee..6657f4b0717a1 100644 --- a/lib/access.js +++ b/lib/access.js @@ -154,7 +154,7 @@ access['ls-packages'] = access.lsPackages = ([owner], opts) => { } access['ls-collaborators'] = access.lsCollaborators = ([pkg, usr], opts) => { - return getPackage(pkg).then(pkgName => + return getPackage(pkg, false).then(pkgName => libaccess.lsCollaborators(pkgName, usr, opts) ).then(collabs => { // TODO - print these out nicely (breaking change) diff --git a/test/tap/access.js b/test/tap/access.js index 6a21ccc8fb3ef..d400b4d33b134 100644 --- a/test/tap/access.js +++ b/test/tap/access.js @@ -469,6 +469,34 @@ test('npm access ls-collaborators on package', function (t) { ) }) +test('npm access ls-collaborators on unscoped', function (t) { + var serverCollaborators = { + 'myorg:myteam': 'write', + 'myorg:anotherteam': 'read' + } + var clientCollaborators = { + 'myorg:myteam': 'read-write', + 'myorg:anotherteam': 'read-only' + } + server.get( + '/-/package/pkg/collaborators?format=cli' + ).reply(200, serverCollaborators) + common.npm( + [ + 'access', + 'ls-collaborators', + 'pkg', + '--registry', common.registry + ], + { cwd: pkg }, + function (er, code, stdout, stderr) { + t.ifError(er, 'npm access ls-collaborators') + t.same(JSON.parse(stdout), clientCollaborators) + t.end() + } + ) +}) + test('npm access ls-collaborators on current w/user filter', function (t) { var serverCollaborators = { 'myorg:myteam': 'write',