11cb0ef41Sopenharmony_ciconst t = require('tap') 21cb0ef41Sopenharmony_ciconst { load: loadMockNpm } = require('../../fixtures/mock-npm.js') 31cb0ef41Sopenharmony_ciconst MockRegistry = require('@npmcli/mock-registry') 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst path = require('path') 61cb0ef41Sopenharmony_ciconst npa = require('npm-package-arg') 71cb0ef41Sopenharmony_ciconst packageName = '@npmcli/test-package' 81cb0ef41Sopenharmony_ciconst spec = npa(packageName) 91cb0ef41Sopenharmony_ciconst auth = { '//registry.npmjs.org/:_authToken': 'test-auth-token' } 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst maintainers = [ 121cb0ef41Sopenharmony_ci { email: 'test-user-a@npmjs.org', name: 'test-user-a' }, 131cb0ef41Sopenharmony_ci { email: 'test-user-b@npmjs.org', name: 'test-user-b' }, 141cb0ef41Sopenharmony_ci] 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciconst workspaceFixture = { 171cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ 181cb0ef41Sopenharmony_ci name: packageName, 191cb0ef41Sopenharmony_ci version: '1.2.3-test', 201cb0ef41Sopenharmony_ci workspaces: ['workspace-a', 'workspace-b', 'workspace-c'], 211cb0ef41Sopenharmony_ci }), 221cb0ef41Sopenharmony_ci 'workspace-a': { 231cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ 241cb0ef41Sopenharmony_ci name: 'workspace-a', 251cb0ef41Sopenharmony_ci version: '1.2.3-a', 261cb0ef41Sopenharmony_ci }), 271cb0ef41Sopenharmony_ci }, 281cb0ef41Sopenharmony_ci 'workspace-b': { 291cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ 301cb0ef41Sopenharmony_ci name: 'workspace-b', 311cb0ef41Sopenharmony_ci version: '1.2.3-n', 321cb0ef41Sopenharmony_ci }), 331cb0ef41Sopenharmony_ci }, 341cb0ef41Sopenharmony_ci 'workspace-c': JSON.stringify({ 351cb0ef41Sopenharmony_ci 'package.json': { 361cb0ef41Sopenharmony_ci name: 'workspace-n', 371cb0ef41Sopenharmony_ci version: '1.2.3-n', 381cb0ef41Sopenharmony_ci }, 391cb0ef41Sopenharmony_ci }), 401cb0ef41Sopenharmony_ci} 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_cifunction registryPackage (t, registry, name) { 431cb0ef41Sopenharmony_ci const mockRegistry = new MockRegistry({ tap: t, registry }) 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci const manifest = mockRegistry.manifest({ 461cb0ef41Sopenharmony_ci name, 471cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 481cb0ef41Sopenharmony_ci }) 491cb0ef41Sopenharmony_ci return mockRegistry.package({ manifest }) 501cb0ef41Sopenharmony_ci} 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_cit.test('owner no args', async t => { 531cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t) 541cb0ef41Sopenharmony_ci await t.rejects( 551cb0ef41Sopenharmony_ci npm.exec('owner', []), 561cb0ef41Sopenharmony_ci { code: 'EUSAGE' }, 571cb0ef41Sopenharmony_ci 'rejects with usage' 581cb0ef41Sopenharmony_ci ) 591cb0ef41Sopenharmony_ci}) 601cb0ef41Sopenharmony_ci 611cb0ef41Sopenharmony_cit.test('owner ls no args', async t => { 621cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 631cb0ef41Sopenharmony_ci prefixDir: { 641cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ name: packageName }), 651cb0ef41Sopenharmony_ci }, 661cb0ef41Sopenharmony_ci }) 671cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 681cb0ef41Sopenharmony_ci tap: t, 691cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 701cb0ef41Sopenharmony_ci }) 711cb0ef41Sopenharmony_ci 721cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 731cb0ef41Sopenharmony_ci name: packageName, 741cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 751cb0ef41Sopenharmony_ci }) 761cb0ef41Sopenharmony_ci await registry.package({ manifest }) 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls']) 791cb0ef41Sopenharmony_ci t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) 801cb0ef41Sopenharmony_ci}) 811cb0ef41Sopenharmony_ci 821cb0ef41Sopenharmony_cit.test('local package.json has no name', async t => { 831cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 841cb0ef41Sopenharmony_ci prefixDir: { 851cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ hello: 'world' }), 861cb0ef41Sopenharmony_ci }, 871cb0ef41Sopenharmony_ci }) 881cb0ef41Sopenharmony_ci await t.rejects( 891cb0ef41Sopenharmony_ci npm.exec('owner', ['ls']), 901cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 911cb0ef41Sopenharmony_ci ) 921cb0ef41Sopenharmony_ci}) 931cb0ef41Sopenharmony_ci 941cb0ef41Sopenharmony_cit.test('owner ls global', async t => { 951cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 961cb0ef41Sopenharmony_ci config: { global: true }, 971cb0ef41Sopenharmony_ci }) 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci await t.rejects( 1001cb0ef41Sopenharmony_ci npm.exec('owner', ['ls']), 1011cb0ef41Sopenharmony_ci { code: 'EUSAGE' }, 1021cb0ef41Sopenharmony_ci 'rejects with usage' 1031cb0ef41Sopenharmony_ci ) 1041cb0ef41Sopenharmony_ci}) 1051cb0ef41Sopenharmony_ci 1061cb0ef41Sopenharmony_cit.test('owner ls no args no cwd package', async t => { 1071cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t) 1081cb0ef41Sopenharmony_ci 1091cb0ef41Sopenharmony_ci await t.rejects( 1101cb0ef41Sopenharmony_ci npm.exec('owner', ['ls']) 1111cb0ef41Sopenharmony_ci ) 1121cb0ef41Sopenharmony_ci}) 1131cb0ef41Sopenharmony_ci 1141cb0ef41Sopenharmony_cit.test('owner ls fails to retrieve packument', async t => { 1151cb0ef41Sopenharmony_ci const { npm, logs } = await loadMockNpm(t, { 1161cb0ef41Sopenharmony_ci prefixDir: { 1171cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ name: packageName }), 1181cb0ef41Sopenharmony_ci }, 1191cb0ef41Sopenharmony_ci }) 1201cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 1211cb0ef41Sopenharmony_ci tap: t, 1221cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 1231cb0ef41Sopenharmony_ci }) 1241cb0ef41Sopenharmony_ci registry.nock.get(`/${spec.escapedName}`).reply(404) 1251cb0ef41Sopenharmony_ci await t.rejects(npm.exec('owner', ['ls'])) 1261cb0ef41Sopenharmony_ci t.match(logs.error, [['owner ls', "Couldn't get owner data", '@npmcli/test-package']]) 1271cb0ef41Sopenharmony_ci}) 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_cit.test('owner ls <pkg>', async t => { 1301cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t) 1311cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 1321cb0ef41Sopenharmony_ci tap: t, 1331cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 1341cb0ef41Sopenharmony_ci }) 1351cb0ef41Sopenharmony_ci 1361cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 1371cb0ef41Sopenharmony_ci name: packageName, 1381cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 1391cb0ef41Sopenharmony_ci }) 1401cb0ef41Sopenharmony_ci await registry.package({ manifest }) 1411cb0ef41Sopenharmony_ci 1421cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls', packageName]) 1431cb0ef41Sopenharmony_ci t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) 1441cb0ef41Sopenharmony_ci}) 1451cb0ef41Sopenharmony_ci 1461cb0ef41Sopenharmony_cit.test('owner ls <pkg> no maintainers', async t => { 1471cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t) 1481cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 1491cb0ef41Sopenharmony_ci tap: t, 1501cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 1511cb0ef41Sopenharmony_ci }) 1521cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 1531cb0ef41Sopenharmony_ci name: packageName, 1541cb0ef41Sopenharmony_ci versions: ['1.0.0'], 1551cb0ef41Sopenharmony_ci }) 1561cb0ef41Sopenharmony_ci await registry.package({ manifest }) 1571cb0ef41Sopenharmony_ci 1581cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls', packageName]) 1591cb0ef41Sopenharmony_ci t.equal(joinedOutput(), 'no admin found') 1601cb0ef41Sopenharmony_ci}) 1611cb0ef41Sopenharmony_ci 1621cb0ef41Sopenharmony_cit.test('owner add <user> <pkg>', async t => { 1631cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 1641cb0ef41Sopenharmony_ci config: { ...auth }, 1651cb0ef41Sopenharmony_ci }) 1661cb0ef41Sopenharmony_ci const username = 'foo' 1671cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 1681cb0ef41Sopenharmony_ci tap: t, 1691cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 1701cb0ef41Sopenharmony_ci }) 1711cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 1721cb0ef41Sopenharmony_ci name: packageName, 1731cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 1741cb0ef41Sopenharmony_ci }) 1751cb0ef41Sopenharmony_ci registry.couchuser({ username }) 1761cb0ef41Sopenharmony_ci await registry.package({ manifest }) 1771cb0ef41Sopenharmony_ci registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { 1781cb0ef41Sopenharmony_ci t.match(body, { 1791cb0ef41Sopenharmony_ci _id: manifest._id, 1801cb0ef41Sopenharmony_ci _rev: manifest._rev, 1811cb0ef41Sopenharmony_ci maintainers: [ 1821cb0ef41Sopenharmony_ci ...manifest.maintainers, 1831cb0ef41Sopenharmony_ci { name: username, email: '' }, 1841cb0ef41Sopenharmony_ci ], 1851cb0ef41Sopenharmony_ci }) 1861cb0ef41Sopenharmony_ci return true 1871cb0ef41Sopenharmony_ci }).reply(200, {}) 1881cb0ef41Sopenharmony_ci await npm.exec('owner', ['add', username, packageName]) 1891cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `+ ${username} (${packageName})`) 1901cb0ef41Sopenharmony_ci}) 1911cb0ef41Sopenharmony_ci 1921cb0ef41Sopenharmony_cit.test('owner add <user> cwd package', async t => { 1931cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 1941cb0ef41Sopenharmony_ci prefixDir: { 1951cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ name: packageName }), 1961cb0ef41Sopenharmony_ci }, 1971cb0ef41Sopenharmony_ci config: { ...auth }, 1981cb0ef41Sopenharmony_ci }) 1991cb0ef41Sopenharmony_ci const username = 'foo' 2001cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 2011cb0ef41Sopenharmony_ci tap: t, 2021cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 2031cb0ef41Sopenharmony_ci }) 2041cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 2051cb0ef41Sopenharmony_ci name: packageName, 2061cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 2071cb0ef41Sopenharmony_ci }) 2081cb0ef41Sopenharmony_ci registry.couchuser({ username }) 2091cb0ef41Sopenharmony_ci await registry.package({ manifest }) 2101cb0ef41Sopenharmony_ci registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { 2111cb0ef41Sopenharmony_ci t.match(body, { 2121cb0ef41Sopenharmony_ci _id: manifest._id, 2131cb0ef41Sopenharmony_ci _rev: manifest._rev, 2141cb0ef41Sopenharmony_ci maintainers: [ 2151cb0ef41Sopenharmony_ci ...manifest.maintainers, 2161cb0ef41Sopenharmony_ci { name: username, email: '' }, 2171cb0ef41Sopenharmony_ci ], 2181cb0ef41Sopenharmony_ci }) 2191cb0ef41Sopenharmony_ci return true 2201cb0ef41Sopenharmony_ci }).reply(200, {}) 2211cb0ef41Sopenharmony_ci await npm.exec('owner', ['add', username]) 2221cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `+ ${username} (${packageName})`) 2231cb0ef41Sopenharmony_ci}) 2241cb0ef41Sopenharmony_ci 2251cb0ef41Sopenharmony_cit.test('owner add <user> <pkg> already an owner', async t => { 2261cb0ef41Sopenharmony_ci const { npm, joinedOutput, logs } = await loadMockNpm(t, { 2271cb0ef41Sopenharmony_ci config: { ...auth }, 2281cb0ef41Sopenharmony_ci }) 2291cb0ef41Sopenharmony_ci const username = maintainers[0].name 2301cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 2311cb0ef41Sopenharmony_ci tap: t, 2321cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 2331cb0ef41Sopenharmony_ci }) 2341cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 2351cb0ef41Sopenharmony_ci name: packageName, 2361cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 2371cb0ef41Sopenharmony_ci }) 2381cb0ef41Sopenharmony_ci registry.couchuser({ username }) 2391cb0ef41Sopenharmony_ci await registry.package({ manifest }) 2401cb0ef41Sopenharmony_ci await npm.exec('owner', ['add', username, packageName]) 2411cb0ef41Sopenharmony_ci t.equal(joinedOutput(), '') 2421cb0ef41Sopenharmony_ci t.match( 2431cb0ef41Sopenharmony_ci logs.info, 2441cb0ef41Sopenharmony_ci [['owner add', 'Already a package owner: test-user-a <test-user-a@npmjs.org>']] 2451cb0ef41Sopenharmony_ci ) 2461cb0ef41Sopenharmony_ci}) 2471cb0ef41Sopenharmony_ci 2481cb0ef41Sopenharmony_cit.test('owner add <user> <pkg> fails to retrieve user', async t => { 2491cb0ef41Sopenharmony_ci const { npm, logs } = await loadMockNpm(t, { 2501cb0ef41Sopenharmony_ci config: { ...auth }, 2511cb0ef41Sopenharmony_ci }) 2521cb0ef41Sopenharmony_ci const username = 'foo' 2531cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 2541cb0ef41Sopenharmony_ci tap: t, 2551cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 2561cb0ef41Sopenharmony_ci }) 2571cb0ef41Sopenharmony_ci registry.couchuser({ username, responseCode: 404, body: {} }) 2581cb0ef41Sopenharmony_ci await t.rejects(npm.exec('owner', ['add', username, packageName])) 2591cb0ef41Sopenharmony_ci t.match(logs.error, [['owner mutate', `Error getting user data for ${username}`]]) 2601cb0ef41Sopenharmony_ci}) 2611cb0ef41Sopenharmony_ci 2621cb0ef41Sopenharmony_cit.test('owner add <user> <pkg> fails to PUT updates', async t => { 2631cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 2641cb0ef41Sopenharmony_ci config: { ...auth }, 2651cb0ef41Sopenharmony_ci }) 2661cb0ef41Sopenharmony_ci const username = 'foo' 2671cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 2681cb0ef41Sopenharmony_ci tap: t, 2691cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 2701cb0ef41Sopenharmony_ci }) 2711cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 2721cb0ef41Sopenharmony_ci name: packageName, 2731cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 2741cb0ef41Sopenharmony_ci }) 2751cb0ef41Sopenharmony_ci registry.couchuser({ username }) 2761cb0ef41Sopenharmony_ci await registry.package({ manifest }) 2771cb0ef41Sopenharmony_ci registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`).reply(404, {}) 2781cb0ef41Sopenharmony_ci await t.rejects( 2791cb0ef41Sopenharmony_ci npm.exec('owner', ['add', username, packageName]), 2801cb0ef41Sopenharmony_ci { code: 'EOWNERMUTATE' } 2811cb0ef41Sopenharmony_ci ) 2821cb0ef41Sopenharmony_ci}) 2831cb0ef41Sopenharmony_ci 2841cb0ef41Sopenharmony_cit.test('owner add <user> <pkg> no previous maintainers property from server', async t => { 2851cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 2861cb0ef41Sopenharmony_ci config: { ...auth }, 2871cb0ef41Sopenharmony_ci }) 2881cb0ef41Sopenharmony_ci const username = 'foo' 2891cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 2901cb0ef41Sopenharmony_ci tap: t, 2911cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 2921cb0ef41Sopenharmony_ci }) 2931cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 2941cb0ef41Sopenharmony_ci name: packageName, 2951cb0ef41Sopenharmony_ci packuments: [{ maintainers: undefined, version: '1.0.0' }], 2961cb0ef41Sopenharmony_ci }) 2971cb0ef41Sopenharmony_ci registry.couchuser({ username }) 2981cb0ef41Sopenharmony_ci await registry.package({ manifest }) 2991cb0ef41Sopenharmony_ci registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { 3001cb0ef41Sopenharmony_ci t.match(body, { 3011cb0ef41Sopenharmony_ci _id: manifest._id, 3021cb0ef41Sopenharmony_ci _rev: manifest._rev, 3031cb0ef41Sopenharmony_ci maintainers: [{ name: username, email: '' }], 3041cb0ef41Sopenharmony_ci }) 3051cb0ef41Sopenharmony_ci return true 3061cb0ef41Sopenharmony_ci }).reply(200, {}) 3071cb0ef41Sopenharmony_ci await npm.exec('owner', ['add', username, packageName]) 3081cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `+ ${username} (${packageName})`) 3091cb0ef41Sopenharmony_ci}) 3101cb0ef41Sopenharmony_ci 3111cb0ef41Sopenharmony_cit.test('owner add no user', async t => { 3121cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t) 3131cb0ef41Sopenharmony_ci 3141cb0ef41Sopenharmony_ci await t.rejects( 3151cb0ef41Sopenharmony_ci npm.exec('owner', ['add']), 3161cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 3171cb0ef41Sopenharmony_ci ) 3181cb0ef41Sopenharmony_ci}) 3191cb0ef41Sopenharmony_ci 3201cb0ef41Sopenharmony_cit.test('owner add <user> no pkg global', async t => { 3211cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 3221cb0ef41Sopenharmony_ci config: { global: true }, 3231cb0ef41Sopenharmony_ci }) 3241cb0ef41Sopenharmony_ci 3251cb0ef41Sopenharmony_ci await t.rejects( 3261cb0ef41Sopenharmony_ci npm.exec('owner', ['add', 'foo']), 3271cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 3281cb0ef41Sopenharmony_ci ) 3291cb0ef41Sopenharmony_ci}) 3301cb0ef41Sopenharmony_ci 3311cb0ef41Sopenharmony_cit.test('owner add <user> no cwd package', async t => { 3321cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t) 3331cb0ef41Sopenharmony_ci 3341cb0ef41Sopenharmony_ci await t.rejects( 3351cb0ef41Sopenharmony_ci npm.exec('owner', ['add', 'foo']), 3361cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 3371cb0ef41Sopenharmony_ci ) 3381cb0ef41Sopenharmony_ci}) 3391cb0ef41Sopenharmony_ci 3401cb0ef41Sopenharmony_cit.test('owner rm <user> <pkg>', async t => { 3411cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 3421cb0ef41Sopenharmony_ci config: { ...auth }, 3431cb0ef41Sopenharmony_ci }) 3441cb0ef41Sopenharmony_ci const username = maintainers[0].name 3451cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 3461cb0ef41Sopenharmony_ci tap: t, 3471cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 3481cb0ef41Sopenharmony_ci }) 3491cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 3501cb0ef41Sopenharmony_ci name: packageName, 3511cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 3521cb0ef41Sopenharmony_ci }) 3531cb0ef41Sopenharmony_ci registry.couchuser({ username }) 3541cb0ef41Sopenharmony_ci await registry.package({ manifest }) 3551cb0ef41Sopenharmony_ci registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { 3561cb0ef41Sopenharmony_ci t.match(body, { 3571cb0ef41Sopenharmony_ci _id: manifest._id, 3581cb0ef41Sopenharmony_ci _rev: manifest._rev, 3591cb0ef41Sopenharmony_ci maintainers: maintainers.slice(1), 3601cb0ef41Sopenharmony_ci }) 3611cb0ef41Sopenharmony_ci return true 3621cb0ef41Sopenharmony_ci }).reply(200, {}) 3631cb0ef41Sopenharmony_ci await npm.exec('owner', ['rm', username, packageName]) 3641cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `- ${username} (${packageName})`) 3651cb0ef41Sopenharmony_ci}) 3661cb0ef41Sopenharmony_ci 3671cb0ef41Sopenharmony_cit.test('owner rm <user> <pkg> not a current owner', async t => { 3681cb0ef41Sopenharmony_ci const { npm, logs } = await loadMockNpm(t, { 3691cb0ef41Sopenharmony_ci config: { ...auth }, 3701cb0ef41Sopenharmony_ci }) 3711cb0ef41Sopenharmony_ci const username = 'foo' 3721cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 3731cb0ef41Sopenharmony_ci tap: t, 3741cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 3751cb0ef41Sopenharmony_ci }) 3761cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 3771cb0ef41Sopenharmony_ci name: packageName, 3781cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 3791cb0ef41Sopenharmony_ci }) 3801cb0ef41Sopenharmony_ci registry.couchuser({ username }) 3811cb0ef41Sopenharmony_ci await registry.package({ manifest }) 3821cb0ef41Sopenharmony_ci await npm.exec('owner', ['rm', username, packageName]) 3831cb0ef41Sopenharmony_ci t.match(logs.info, [['owner rm', `Not a package owner: ${username}`]]) 3841cb0ef41Sopenharmony_ci}) 3851cb0ef41Sopenharmony_ci 3861cb0ef41Sopenharmony_cit.test('owner rm <user> cwd package', async t => { 3871cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 3881cb0ef41Sopenharmony_ci prefixDir: { 3891cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ name: packageName }), 3901cb0ef41Sopenharmony_ci }, 3911cb0ef41Sopenharmony_ci config: { ...auth }, 3921cb0ef41Sopenharmony_ci }) 3931cb0ef41Sopenharmony_ci const username = maintainers[0].name 3941cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 3951cb0ef41Sopenharmony_ci tap: t, 3961cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 3971cb0ef41Sopenharmony_ci }) 3981cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 3991cb0ef41Sopenharmony_ci name: packageName, 4001cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 4011cb0ef41Sopenharmony_ci }) 4021cb0ef41Sopenharmony_ci registry.couchuser({ username }) 4031cb0ef41Sopenharmony_ci await registry.package({ manifest }) 4041cb0ef41Sopenharmony_ci registry.nock.put(`/${spec.escapedName}/-rev/${manifest._rev}`, body => { 4051cb0ef41Sopenharmony_ci t.match(body, { 4061cb0ef41Sopenharmony_ci _id: manifest._id, 4071cb0ef41Sopenharmony_ci _rev: manifest._rev, 4081cb0ef41Sopenharmony_ci maintainers: maintainers.slice(1), 4091cb0ef41Sopenharmony_ci }) 4101cb0ef41Sopenharmony_ci return true 4111cb0ef41Sopenharmony_ci }).reply(200, {}) 4121cb0ef41Sopenharmony_ci await npm.exec('owner', ['rm', username]) 4131cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `- ${username} (${packageName})`) 4141cb0ef41Sopenharmony_ci}) 4151cb0ef41Sopenharmony_ci 4161cb0ef41Sopenharmony_cit.test('owner rm <user> only user', async t => { 4171cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 4181cb0ef41Sopenharmony_ci prefixDir: { 4191cb0ef41Sopenharmony_ci 'package.json': JSON.stringify({ name: packageName }), 4201cb0ef41Sopenharmony_ci }, 4211cb0ef41Sopenharmony_ci config: { ...auth }, 4221cb0ef41Sopenharmony_ci }) 4231cb0ef41Sopenharmony_ci const username = maintainers[0].name 4241cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 4251cb0ef41Sopenharmony_ci tap: t, 4261cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 4271cb0ef41Sopenharmony_ci }) 4281cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 4291cb0ef41Sopenharmony_ci name: packageName, 4301cb0ef41Sopenharmony_ci packuments: [{ maintainers: maintainers.slice(0, 1), version: '1.0.0' }], 4311cb0ef41Sopenharmony_ci }) 4321cb0ef41Sopenharmony_ci registry.couchuser({ username }) 4331cb0ef41Sopenharmony_ci await registry.package({ manifest }) 4341cb0ef41Sopenharmony_ci await t.rejects( 4351cb0ef41Sopenharmony_ci npm.exec('owner', ['rm', username]), 4361cb0ef41Sopenharmony_ci { 4371cb0ef41Sopenharmony_ci code: 'EOWNERRM', 4381cb0ef41Sopenharmony_ci message: 'Cannot remove all owners of a package. Add someone else first.', 4391cb0ef41Sopenharmony_ci } 4401cb0ef41Sopenharmony_ci ) 4411cb0ef41Sopenharmony_ci}) 4421cb0ef41Sopenharmony_ci 4431cb0ef41Sopenharmony_cit.test('owner rm no user', async t => { 4441cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t) 4451cb0ef41Sopenharmony_ci await t.rejects( 4461cb0ef41Sopenharmony_ci npm.exec('owner', ['rm']), 4471cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 4481cb0ef41Sopenharmony_ci ) 4491cb0ef41Sopenharmony_ci}) 4501cb0ef41Sopenharmony_ci 4511cb0ef41Sopenharmony_cit.test('owner rm no pkg global', async t => { 4521cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 4531cb0ef41Sopenharmony_ci config: { global: true }, 4541cb0ef41Sopenharmony_ci }) 4551cb0ef41Sopenharmony_ci await t.rejects( 4561cb0ef41Sopenharmony_ci npm.exec('owner', ['rm', 'foo']), 4571cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 4581cb0ef41Sopenharmony_ci ) 4591cb0ef41Sopenharmony_ci}) 4601cb0ef41Sopenharmony_ci 4611cb0ef41Sopenharmony_cit.test('owner rm <user> no cwd package', async t => { 4621cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t) 4631cb0ef41Sopenharmony_ci await t.rejects( 4641cb0ef41Sopenharmony_ci npm.exec('owner', ['rm', 'foo']), 4651cb0ef41Sopenharmony_ci { code: 'EUSAGE' } 4661cb0ef41Sopenharmony_ci ) 4671cb0ef41Sopenharmony_ci}) 4681cb0ef41Sopenharmony_ci 4691cb0ef41Sopenharmony_cit.test('workspaces', async t => { 4701cb0ef41Sopenharmony_ci t.test('owner no args --workspace', async t => { 4711cb0ef41Sopenharmony_ci const { npm } = await loadMockNpm(t, { 4721cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 4731cb0ef41Sopenharmony_ci config: { 4741cb0ef41Sopenharmony_ci workspace: 'workspace-a', 4751cb0ef41Sopenharmony_ci }, 4761cb0ef41Sopenharmony_ci }) 4771cb0ef41Sopenharmony_ci await t.rejects( 4781cb0ef41Sopenharmony_ci npm.exec('owner', []), 4791cb0ef41Sopenharmony_ci { code: 'EUSAGE' }, 4801cb0ef41Sopenharmony_ci 'rejects with usage' 4811cb0ef41Sopenharmony_ci ) 4821cb0ef41Sopenharmony_ci }) 4831cb0ef41Sopenharmony_ci 4841cb0ef41Sopenharmony_ci t.test('owner ls implicit workspace', async t => { 4851cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 4861cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 4871cb0ef41Sopenharmony_ci chdir: ({ prefix }) => path.join(prefix, 'workspace-a'), 4881cb0ef41Sopenharmony_ci }) 4891cb0ef41Sopenharmony_ci await registryPackage(t, npm.config.get('registry'), 'workspace-a') 4901cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls']) 4911cb0ef41Sopenharmony_ci t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) 4921cb0ef41Sopenharmony_ci }) 4931cb0ef41Sopenharmony_ci 4941cb0ef41Sopenharmony_ci t.test('owner ls explicit workspace', async t => { 4951cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 4961cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 4971cb0ef41Sopenharmony_ci config: { 4981cb0ef41Sopenharmony_ci workspace: 'workspace-a', 4991cb0ef41Sopenharmony_ci }, 5001cb0ef41Sopenharmony_ci }) 5011cb0ef41Sopenharmony_ci await registryPackage(t, npm.config.get('registry'), 'workspace-a') 5021cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls']) 5031cb0ef41Sopenharmony_ci t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) 5041cb0ef41Sopenharmony_ci }) 5051cb0ef41Sopenharmony_ci 5061cb0ef41Sopenharmony_ci t.test('owner ls <pkg> implicit workspace', async t => { 5071cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 5081cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 5091cb0ef41Sopenharmony_ci chdir: ({ prefix }) => path.join(prefix, 'workspace-a'), 5101cb0ef41Sopenharmony_ci }) 5111cb0ef41Sopenharmony_ci await registryPackage(t, npm.config.get('registry'), packageName) 5121cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls', packageName]) 5131cb0ef41Sopenharmony_ci t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) 5141cb0ef41Sopenharmony_ci }) 5151cb0ef41Sopenharmony_ci 5161cb0ef41Sopenharmony_ci t.test('owner ls <pkg> explicit workspace', async t => { 5171cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 5181cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 5191cb0ef41Sopenharmony_ci config: { 5201cb0ef41Sopenharmony_ci workspace: 'workspace-a', 5211cb0ef41Sopenharmony_ci }, 5221cb0ef41Sopenharmony_ci }) 5231cb0ef41Sopenharmony_ci await registryPackage(t, npm.config.get('registry'), packageName) 5241cb0ef41Sopenharmony_ci await npm.exec('owner', ['ls', packageName]) 5251cb0ef41Sopenharmony_ci t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) 5261cb0ef41Sopenharmony_ci }) 5271cb0ef41Sopenharmony_ci 5281cb0ef41Sopenharmony_ci t.test('owner add implicit workspace', async t => { 5291cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 5301cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 5311cb0ef41Sopenharmony_ci chdir: ({ prefix }) => path.join(prefix, 'workspace-a'), 5321cb0ef41Sopenharmony_ci }) 5331cb0ef41Sopenharmony_ci const username = 'foo' 5341cb0ef41Sopenharmony_ci const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry') }) 5351cb0ef41Sopenharmony_ci 5361cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 5371cb0ef41Sopenharmony_ci name: 'workspace-a', 5381cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 5391cb0ef41Sopenharmony_ci }) 5401cb0ef41Sopenharmony_ci await registry.package({ manifest }) 5411cb0ef41Sopenharmony_ci registry.couchuser({ username }) 5421cb0ef41Sopenharmony_ci registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { 5431cb0ef41Sopenharmony_ci t.match(body, { 5441cb0ef41Sopenharmony_ci _id: manifest._id, 5451cb0ef41Sopenharmony_ci _rev: manifest._rev, 5461cb0ef41Sopenharmony_ci maintainers: [ 5471cb0ef41Sopenharmony_ci ...manifest.maintainers, 5481cb0ef41Sopenharmony_ci { name: username, email: '' }, 5491cb0ef41Sopenharmony_ci ], 5501cb0ef41Sopenharmony_ci }) 5511cb0ef41Sopenharmony_ci return true 5521cb0ef41Sopenharmony_ci }).reply(200, {}) 5531cb0ef41Sopenharmony_ci await npm.exec('owner', ['add', username]) 5541cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `+ ${username} (workspace-a)`) 5551cb0ef41Sopenharmony_ci }) 5561cb0ef41Sopenharmony_ci 5571cb0ef41Sopenharmony_ci t.test('owner add --workspace', async t => { 5581cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 5591cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 5601cb0ef41Sopenharmony_ci config: { 5611cb0ef41Sopenharmony_ci workspace: 'workspace-a', 5621cb0ef41Sopenharmony_ci }, 5631cb0ef41Sopenharmony_ci }) 5641cb0ef41Sopenharmony_ci const username = 'foo' 5651cb0ef41Sopenharmony_ci const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry') }) 5661cb0ef41Sopenharmony_ci 5671cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 5681cb0ef41Sopenharmony_ci name: 'workspace-a', 5691cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 5701cb0ef41Sopenharmony_ci }) 5711cb0ef41Sopenharmony_ci await registry.package({ manifest }) 5721cb0ef41Sopenharmony_ci registry.couchuser({ username }) 5731cb0ef41Sopenharmony_ci registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { 5741cb0ef41Sopenharmony_ci t.match(body, { 5751cb0ef41Sopenharmony_ci _id: manifest._id, 5761cb0ef41Sopenharmony_ci _rev: manifest._rev, 5771cb0ef41Sopenharmony_ci maintainers: [ 5781cb0ef41Sopenharmony_ci ...manifest.maintainers, 5791cb0ef41Sopenharmony_ci { name: username, email: '' }, 5801cb0ef41Sopenharmony_ci ], 5811cb0ef41Sopenharmony_ci }) 5821cb0ef41Sopenharmony_ci return true 5831cb0ef41Sopenharmony_ci }).reply(200, {}) 5841cb0ef41Sopenharmony_ci await npm.exec('owner', ['add', username]) 5851cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `+ ${username} (workspace-a)`) 5861cb0ef41Sopenharmony_ci }) 5871cb0ef41Sopenharmony_ci 5881cb0ef41Sopenharmony_ci t.test('owner rm --workspace', async t => { 5891cb0ef41Sopenharmony_ci const { npm, joinedOutput } = await loadMockNpm(t, { 5901cb0ef41Sopenharmony_ci prefixDir: workspaceFixture, 5911cb0ef41Sopenharmony_ci chdir: ({ prefix }) => path.join(prefix, 'workspace-a'), 5921cb0ef41Sopenharmony_ci }) 5931cb0ef41Sopenharmony_ci const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry') }) 5941cb0ef41Sopenharmony_ci 5951cb0ef41Sopenharmony_ci const username = maintainers[0].name 5961cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 5971cb0ef41Sopenharmony_ci name: 'workspace-a', 5981cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 5991cb0ef41Sopenharmony_ci }) 6001cb0ef41Sopenharmony_ci await registry.package({ manifest }) 6011cb0ef41Sopenharmony_ci registry.couchuser({ username }) 6021cb0ef41Sopenharmony_ci registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { 6031cb0ef41Sopenharmony_ci t.match(body, { 6041cb0ef41Sopenharmony_ci _id: manifest._id, 6051cb0ef41Sopenharmony_ci _rev: manifest._rev, 6061cb0ef41Sopenharmony_ci maintainers: maintainers.slice(1), 6071cb0ef41Sopenharmony_ci }) 6081cb0ef41Sopenharmony_ci return true 6091cb0ef41Sopenharmony_ci }).reply(200, {}) 6101cb0ef41Sopenharmony_ci await npm.exec('owner', ['rm', username]) 6111cb0ef41Sopenharmony_ci t.equal(joinedOutput(), `- ${username} (workspace-a)`) 6121cb0ef41Sopenharmony_ci }) 6131cb0ef41Sopenharmony_ci}) 6141cb0ef41Sopenharmony_ci 6151cb0ef41Sopenharmony_cit.test('completion', async t => { 6161cb0ef41Sopenharmony_ci const mockCompletion = (t, opts) => loadMockNpm(t, { command: 'owner', ...opts }) 6171cb0ef41Sopenharmony_ci 6181cb0ef41Sopenharmony_ci t.test('basic commands', async t => { 6191cb0ef41Sopenharmony_ci const { owner } = await mockCompletion(t) 6201cb0ef41Sopenharmony_ci const testComp = async (argv, expect) => { 6211cb0ef41Sopenharmony_ci const res = await owner.completion({ conf: { argv: { remain: argv } } }) 6221cb0ef41Sopenharmony_ci t.strictSame(res, expect, argv.join(' ')) 6231cb0ef41Sopenharmony_ci } 6241cb0ef41Sopenharmony_ci 6251cb0ef41Sopenharmony_ci await Promise.all([ 6261cb0ef41Sopenharmony_ci testComp(['npm', 'foo'], []), 6271cb0ef41Sopenharmony_ci testComp(['npm', 'owner'], ['add', 'rm', 'ls']), 6281cb0ef41Sopenharmony_ci testComp(['npm', 'owner', 'add'], []), 6291cb0ef41Sopenharmony_ci testComp(['npm', 'owner', 'ls'], []), 6301cb0ef41Sopenharmony_ci testComp(['npm', 'owner', 'rm', 'foo'], []), 6311cb0ef41Sopenharmony_ci ]) 6321cb0ef41Sopenharmony_ci }) 6331cb0ef41Sopenharmony_ci 6341cb0ef41Sopenharmony_ci t.test('completion npm owner rm', async t => { 6351cb0ef41Sopenharmony_ci const { npm, owner } = await mockCompletion(t, { 6361cb0ef41Sopenharmony_ci prefixDir: { 'package.json': JSON.stringify({ name: packageName }) }, 6371cb0ef41Sopenharmony_ci }) 6381cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 6391cb0ef41Sopenharmony_ci tap: t, 6401cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 6411cb0ef41Sopenharmony_ci }) 6421cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 6431cb0ef41Sopenharmony_ci name: packageName, 6441cb0ef41Sopenharmony_ci packuments: [{ maintainers, version: '1.0.0' }], 6451cb0ef41Sopenharmony_ci }) 6461cb0ef41Sopenharmony_ci await registry.package({ manifest }) 6471cb0ef41Sopenharmony_ci const res = await owner.completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) 6481cb0ef41Sopenharmony_ci t.strictSame(res, maintainers.map(m => m.name), 'should return list of current owners') 6491cb0ef41Sopenharmony_ci }) 6501cb0ef41Sopenharmony_ci 6511cb0ef41Sopenharmony_ci t.test('completion npm owner rm no cwd package', async t => { 6521cb0ef41Sopenharmony_ci const { owner } = await mockCompletion(t) 6531cb0ef41Sopenharmony_ci const res = await owner.completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) 6541cb0ef41Sopenharmony_ci t.strictSame(res, [], 'should have no owners to autocomplete if not cwd package') 6551cb0ef41Sopenharmony_ci }) 6561cb0ef41Sopenharmony_ci 6571cb0ef41Sopenharmony_ci t.test('completion npm owner rm global', async t => { 6581cb0ef41Sopenharmony_ci const { owner } = await mockCompletion(t, { 6591cb0ef41Sopenharmony_ci config: { global: true }, 6601cb0ef41Sopenharmony_ci }) 6611cb0ef41Sopenharmony_ci const res = await owner.completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) 6621cb0ef41Sopenharmony_ci t.strictSame(res, [], 'should have no owners to autocomplete if global') 6631cb0ef41Sopenharmony_ci }) 6641cb0ef41Sopenharmony_ci 6651cb0ef41Sopenharmony_ci t.test('completion npm owner rm no owners found', async t => { 6661cb0ef41Sopenharmony_ci const { npm, owner } = await mockCompletion(t, { 6671cb0ef41Sopenharmony_ci prefixDir: { 'package.json': JSON.stringify({ name: packageName }) }, 6681cb0ef41Sopenharmony_ci }) 6691cb0ef41Sopenharmony_ci const registry = new MockRegistry({ 6701cb0ef41Sopenharmony_ci tap: t, 6711cb0ef41Sopenharmony_ci registry: npm.config.get('registry'), 6721cb0ef41Sopenharmony_ci }) 6731cb0ef41Sopenharmony_ci const manifest = registry.manifest({ 6741cb0ef41Sopenharmony_ci name: packageName, 6751cb0ef41Sopenharmony_ci packuments: [{ maintainers: [], version: '1.0.0' }], 6761cb0ef41Sopenharmony_ci }) 6771cb0ef41Sopenharmony_ci await registry.package({ manifest }) 6781cb0ef41Sopenharmony_ci 6791cb0ef41Sopenharmony_ci const res = await owner.completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) 6801cb0ef41Sopenharmony_ci t.strictSame(res, [], 'should return no owners if not found') 6811cb0ef41Sopenharmony_ci }) 6821cb0ef41Sopenharmony_ci}) 683