Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ access.grant = ([perms, scopeteam, pkg], opts) => {
}
return modifyPackage(pkg, opts, (pkgName, opts) => {
return libaccess.grant(pkgName, scopeteam, perms, opts)
})
}, false)
})
}

Expand Down
27 changes: 27 additions & 0 deletions test/tap/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,33 @@ test('npm access grant read-write', function (t) {
)
})

test('npm access grant read-write on unscoped package', function (t) {
server.filteringRequestBody((body) => {
const data = JSON.parse(body)
t.deepEqual(data, {
permissions: 'read-write',
package: 'another'
}, 'got the right body')
return true
})
server.put('/-/team/myorg/myteam/package', true).reply(201)
common.npm(
[
'access',
'grant', 'read-write',
'myorg:myteam',
'another',
'--registry', common.registry
],
{ cwd: pkg },
function (er, code, stdout, stderr) {
t.ifError(er, 'npm access grant')
t.equal(code, 0, 'exited with Error')
t.end()
}
)
})

test('npm access grant others', function (t) {
common.npm(
[
Expand Down