diff --git a/docs/lib/content/commands/npm-star.md b/docs/lib/content/commands/npm-star.md deleted file mode 100644 index 6c3813abc09ea..0000000000000 --- a/docs/lib/content/commands/npm-star.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: npm-star -section: 1 -description: Mark your favorite packages ---- - -### Synopsis - - - -### Description - -"Starring" a package means that you have some interest in it. -It's a vaguely positive way to show that you care. - -It's a boolean thing. -Starring repeatedly has no additional effect. - -### More - -There's also these extra commands to help you manage your favorite packages: - -#### Unstar - -You can also "unstar" a package using [`npm unstar`](/commands/npm-unstar) - -"Unstarring" is the same thing, but in reverse. - -#### Listing stars - -You can see all your starred packages using [`npm stars`](/commands/npm-stars) - -### Configuration - - - -### See Also - -* [package spec](/using-npm/package-spec) -* [npm unstar](/commands/npm-unstar) -* [npm stars](/commands/npm-stars) -* [npm view](/commands/npm-view) -* [npm whoami](/commands/npm-whoami) -* [npm login](/commands/npm-login) diff --git a/docs/lib/content/commands/npm-stars.md b/docs/lib/content/commands/npm-stars.md deleted file mode 100644 index 7b9a6cf7e93d2..0000000000000 --- a/docs/lib/content/commands/npm-stars.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: npm-stars -section: 1 -description: View packages marked as favorites ---- - -### Synopsis - - - -### Description - -If you have starred a lot of neat things and want to find them again quickly this command lets you do just that. - -You may also want to see your friend's favorite packages, in this case you will most certainly enjoy this command. - -### Configuration - - - -### See Also - -* [npm star](/commands/npm-star) -* [npm unstar](/commands/npm-unstar) -* [npm view](/commands/npm-view) -* [npm whoami](/commands/npm-whoami) -* [npm login](/commands/npm-login) diff --git a/docs/lib/content/commands/npm-unstar.md b/docs/lib/content/commands/npm-unstar.md deleted file mode 100644 index 40c09d51d03fc..0000000000000 --- a/docs/lib/content/commands/npm-unstar.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: npm-unstar -section: 1 -description: Remove an item from your favorite packages ---- - -### Synopsis - - - -### Description - -"Unstarring" a package is the opposite of [`npm star`](/commands/npm-star), it removes an item from your list of favorite packages. - -### More - -There's also these extra commands to help you manage your favorite packages: - -#### Star - -You can "star" a package using [`npm star`](/commands/npm-star) - -#### Listing stars - -You can see all your starred packages using [`npm stars`](/commands/npm-stars) - -### Configuration - - - -### See Also - -* [npm star](/commands/npm-star) -* [npm stars](/commands/npm-stars) -* [npm view](/commands/npm-view) -* [npm whoami](/commands/npm-whoami) -* [npm login](/commands/npm-login) - diff --git a/docs/lib/content/nav.yml b/docs/lib/content/nav.yml index cb7644db47331..92fb860f6cd6e 100644 --- a/docs/lib/content/nav.yml +++ b/docs/lib/content/nav.yml @@ -162,12 +162,6 @@ - title: npm shrinkwrap url: /commands/npm-shrinkwrap description: Lock down dependency versions for publication - - title: npm star - url: /commands/npm-star - description: Mark your favorite packages - - title: npm stars - url: /commands/npm-stars - description: View packages marked as favorites - title: npm start url: /commands/npm-start description: Start a package @@ -195,9 +189,6 @@ - title: npm unpublish url: /commands/npm-unpublish description: Remove a package from the registry - - title: npm unstar - url: /commands/npm-unstar - description: Remove an item from your favorite packages - title: npm update url: /commands/npm-update description: Update packages diff --git a/lib/commands/star.js b/lib/commands/star.js deleted file mode 100644 index 7d1be1d389730..0000000000000 --- a/lib/commands/star.js +++ /dev/null @@ -1,72 +0,0 @@ -const npmFetch = require('npm-registry-fetch') -const npa = require('npm-package-arg') -const { log, output } = require('proc-log') -const getIdentity = require('../utils/get-identity') -const BaseCommand = require('../base-cmd.js') - -class Star extends BaseCommand { - static description = 'Mark your favorite packages' - static name = 'star' - static usage = ['[...]'] - static params = [ - 'registry', - 'unicode', - 'otp', - ] - - static ignoreImplicitWorkspace = false - - async exec (args) { - if (!args.length) { - throw this.usageError() - } - - // if we're unstarring, then show an empty star image - // otherwise, show the full star image - const unicode = this.npm.config.get('unicode') - const full = unicode ? '\u2605 ' : '(*)' - const empty = unicode ? '\u2606 ' : '( )' - const show = this.name === 'star' ? full : empty - - const pkgs = args.map(npa) - const username = await getIdentity(this.npm, this.npm.flatOptions) - - for (const pkg of pkgs) { - const fullData = await npmFetch.json(pkg.escapedName, { - ...this.npm.flatOptions, - spec: pkg, - query: { write: true }, - preferOnline: true, - }) - - const body = { - _id: fullData._id, - _rev: fullData._rev, - users: fullData.users || {}, - } - - if (this.name === 'star') { - log.info('star', 'starring', body._id) - body.users[username] = true - log.verbose('star', 'starring', body) - } else { - delete body.users[username] - log.info('unstar', 'unstarring', body._id) - log.verbose('unstar', 'unstarring', body) - } - - const data = await npmFetch.json(pkg.escapedName, { - ...this.npm.flatOptions, - spec: pkg, - method: 'PUT', - body, - }) - - output.standard(show + ' ' + pkg.name) - log.verbose('star', data) - return data - } - } -} - -module.exports = Star diff --git a/lib/commands/stars.js b/lib/commands/stars.js deleted file mode 100644 index d059d01250900..0000000000000 --- a/lib/commands/stars.js +++ /dev/null @@ -1,39 +0,0 @@ -const npmFetch = require('npm-registry-fetch') -const { log, output } = require('proc-log') -const getIdentity = require('../utils/get-identity.js') -const BaseCommand = require('../base-cmd.js') - -class Stars extends BaseCommand { - static description = 'View packages marked as favorites' - static name = 'stars' - static usage = ['[]'] - static params = ['registry'] - static ignoreImplicitWorkspace = false - - async exec ([user]) { - try { - if (!user) { - user = await getIdentity(this.npm, this.npm.flatOptions) - } - - const { rows } = await npmFetch.json('/-/_view/starredByUser', { - ...this.npm.flatOptions, - query: { key: `"${user}"` }, - }) - if (rows.length === 0) { - log.warn('stars', 'user has not starred any packages') - } - - for (const row of rows) { - output.standard(row.value) - } - } catch (err) { - if (err.code === 'ENEEDAUTH') { - log.warn('stars', 'auth is required to look up your username') - } - throw err - } - } -} - -module.exports = Stars diff --git a/lib/commands/unstar.js b/lib/commands/unstar.js deleted file mode 100644 index c72966866669a..0000000000000 --- a/lib/commands/unstar.js +++ /dev/null @@ -1,8 +0,0 @@ -const Star = require('./star.js') - -class Unstar extends Star { - static description = 'Remove an item from your favorite packages' - static name = 'unstar' -} - -module.exports = Unstar diff --git a/lib/utils/cmd-list.js b/lib/utils/cmd-list.js index 93714f5c557ab..a83b6098a73d2 100644 --- a/lib/utils/cmd-list.js +++ b/lib/utils/cmd-list.js @@ -54,8 +54,6 @@ const commands = [ 'search', 'set', 'shrinkwrap', - 'star', - 'stars', 'start', 'stop', 'team', @@ -65,7 +63,6 @@ const commands = [ 'undeprecate', 'uninstall', 'unpublish', - 'unstar', 'update', 'version', 'view', diff --git a/smoke-tests/tap-snapshots/test/index.js.test.cjs b/smoke-tests/tap-snapshots/test/index.js.test.cjs index eb42ee329eebe..b3247b148a40b 100644 --- a/smoke-tests/tap-snapshots/test/index.js.test.cjs +++ b/smoke-tests/tap-snapshots/test/index.js.test.cjs @@ -27,9 +27,9 @@ All commands: init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, pkg, prefix, profile, prune, publish, query, rebuild, repo, - restart, root, run, sbom, search, set, shrinkwrap, star, - stars, start, stop, team, test, token, trust, undeprecate, - uninstall, unpublish, unstar, update, version, view, whoami + restart, root, run, sbom, search, set, shrinkwrap, start, + stop, team, test, token, trust, undeprecate, uninstall, + unpublish, update, version, view, whoami Specify configs in the ini-formatted file: {NPM}/{TESTDIR}/home/.npmrc diff --git a/tap-snapshots/test/lib/commands/publish.js.test.cjs b/tap-snapshots/test/lib/commands/publish.js.test.cjs index 2029b3c84c438..c271792f9cfb7 100644 --- a/tap-snapshots/test/lib/commands/publish.js.test.cjs +++ b/tap-snapshots/test/lib/commands/publish.js.test.cjs @@ -203,8 +203,6 @@ Object { "man/man1/npm-search.1", "man/man1/npm-set.1", "man/man1/npm-shrinkwrap.1", - "man/man1/npm-star.1", - "man/man1/npm-stars.1", "man/man1/npm-start.1", "man/man1/npm-stop.1", "man/man1/npm-team.1", @@ -214,7 +212,6 @@ Object { "man/man1/npm-undeprecate.1", "man/man1/npm-uninstall.1", "man/man1/npm-unpublish.1", - "man/man1/npm-unstar.1", "man/man1/npm-update.1", "man/man1/npm-version.1", "man/man1/npm-view.1", diff --git a/tap-snapshots/test/lib/docs.js.test.cjs b/tap-snapshots/test/lib/docs.js.test.cjs index 30fab03268bdb..6eda76b9df716 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -146,8 +146,6 @@ Array [ "search", "set", "shrinkwrap", - "star", - "stars", "start", "stop", "team", @@ -157,7 +155,6 @@ Array [ "undeprecate", "uninstall", "unpublish", - "unstar", "update", "version", "view", @@ -5489,62 +5486,6 @@ Note: This command is unaware of workspaces. NO PARAMS ` -exports[`test/lib/docs.js TAP usage star > must match snapshot 1`] = ` -Mark your favorite packages - -Usage: -npm star [...] - -Options: -[--registry ] [--unicode] [--otp ] - - --registry - The base URL of the npm registry. - - --unicode - When set to true, npm uses unicode characters in the tree output. When - - --otp - This is a one-time password from a two-factor authenticator. It's needed - - -Run "npm help star" for more info - -\`\`\`bash -npm star [...] -\`\`\` - -Note: This command is unaware of workspaces. - -#### \`registry\` -#### \`unicode\` -#### \`otp\` -` - -exports[`test/lib/docs.js TAP usage stars > must match snapshot 1`] = ` -View packages marked as favorites - -Usage: -npm stars [] - -Options: -[--registry ] - - --registry - The base URL of the npm registry. - - -Run "npm help stars" for more info - -\`\`\`bash -npm stars [] -\`\`\` - -Note: This command is unaware of workspaces. - -#### \`registry\` -` - exports[`test/lib/docs.js TAP usage start > must match snapshot 1`] = ` Start a package @@ -5922,38 +5863,6 @@ npm unpublish [] #### \`workspaces\` ` -exports[`test/lib/docs.js TAP usage unstar > must match snapshot 1`] = ` -Remove an item from your favorite packages - -Usage: -npm unstar [...] - -Options: -[--registry ] [--unicode] [--otp ] - - --registry - The base URL of the npm registry. - - --unicode - When set to true, npm uses unicode characters in the tree output. When - - --otp - This is a one-time password from a two-factor authenticator. It's needed - - -Run "npm help unstar" for more info - -\`\`\`bash -npm unstar [...] -\`\`\` - -Note: This command is unaware of workspaces. - -#### \`registry\` -#### \`unicode\` -#### \`otp\` -` - exports[`test/lib/docs.js TAP usage update > must match snapshot 1`] = ` Update packages diff --git a/tap-snapshots/test/lib/npm.js.test.cjs b/tap-snapshots/test/lib/npm.js.test.cjs index 44a7bdcc3d796..7e90e3ca7012d 100644 --- a/tap-snapshots/test/lib/npm.js.test.cjs +++ b/tap-snapshots/test/lib/npm.js.test.cjs @@ -37,9 +37,9 @@ All commands: init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, pkg, prefix, profile, prune, publish, query, rebuild, repo, - restart, root, run, sbom, search, set, shrinkwrap, star, - stars, start, stop, team, test, token, trust, undeprecate, - uninstall, unpublish, unstar, update, version, view, whoami + restart, root, run, sbom, search, set, shrinkwrap, start, + stop, team, test, token, trust, undeprecate, uninstall, + unpublish, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -86,11 +86,10 @@ All commands: query, rebuild, repo, restart, root, run, sbom, search, set, - shrinkwrap, star, stars, - start, stop, team, test, - token, trust, - undeprecate, uninstall, - unpublish, unstar, + shrinkwrap, start, stop, + team, test, token, + trust, undeprecate, + uninstall, unpublish, update, version, view, whoami @@ -139,11 +138,10 @@ All commands: query, rebuild, repo, restart, root, run, sbom, search, set, - shrinkwrap, star, stars, - start, stop, team, test, - token, trust, - undeprecate, uninstall, - unpublish, unstar, + shrinkwrap, start, stop, + team, test, token, + trust, undeprecate, + uninstall, unpublish, update, version, view, whoami @@ -179,9 +177,9 @@ All commands: init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, pkg, prefix, profile, prune, publish, query, rebuild, repo, - restart, root, run, sbom, search, set, shrinkwrap, star, - stars, start, stop, team, test, token, trust, undeprecate, - uninstall, unpublish, unstar, update, version, view, whoami + restart, root, run, sbom, search, set, shrinkwrap, start, + stop, team, test, token, trust, undeprecate, uninstall, + unpublish, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -228,11 +226,10 @@ All commands: query, rebuild, repo, restart, root, run, sbom, search, set, - shrinkwrap, star, stars, - start, stop, team, test, - token, trust, - undeprecate, uninstall, - unpublish, unstar, + shrinkwrap, start, stop, + team, test, token, + trust, undeprecate, + uninstall, unpublish, update, version, view, whoami @@ -281,11 +278,10 @@ All commands: query, rebuild, repo, restart, root, run, sbom, search, set, - shrinkwrap, star, stars, - start, stop, team, test, - token, trust, - undeprecate, uninstall, - unpublish, unstar, + shrinkwrap, start, stop, + team, test, token, + trust, undeprecate, + uninstall, unpublish, update, version, view, whoami @@ -333,12 +329,11 @@ All commands: query, rebuild, repo, restart, root, run, sbom, search, set, shrinkwrap, - star, stars, start, stop, - team, test, token, trust, + start, stop, team, test, + token, trust, undeprecate, uninstall, - unpublish, unstar, - update, version, view, - whoami + unpublish, update, + version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -373,9 +368,8 @@ All commands: link, ll, login, logout, ls, org, outdated, owner, pack, ping, pkg, prefix, profile, prune, publish, query, rebuild, repo, restart, root, run, sbom, search, set, shrinkwrap, - star, stars, start, stop, team, test, token, trust, - undeprecate, uninstall, unpublish, unstar, update, version, - view, whoami + start, stop, team, test, token, trust, undeprecate, + uninstall, unpublish, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -409,9 +403,9 @@ All commands: init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, pkg, prefix, profile, prune, publish, query, rebuild, repo, - restart, root, run, sbom, search, set, shrinkwrap, star, - stars, start, stop, team, test, token, trust, undeprecate, - uninstall, unpublish, unstar, update, version, view, whoami + restart, root, run, sbom, search, set, shrinkwrap, start, + stop, team, test, token, trust, undeprecate, uninstall, + unpublish, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} @@ -445,9 +439,9 @@ All commands: init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, pkg, prefix, profile, prune, publish, query, rebuild, repo, - restart, root, run, sbom, search, set, shrinkwrap, star, - stars, start, stop, team, test, token, trust, undeprecate, - uninstall, unpublish, unstar, update, version, view, whoami + restart, root, run, sbom, search, set, shrinkwrap, start, + stop, team, test, token, trust, undeprecate, uninstall, + unpublish, update, version, view, whoami Specify configs in the ini-formatted file: {USERCONFIG} diff --git a/test/lib/commands/help.js b/test/lib/commands/help.js index 3fda9fb6e07fd..77d05d7b5048c 100644 --- a/test/lib/commands/help.js +++ b/test/lib/commands/help.js @@ -30,7 +30,7 @@ const genManPages = (obj) => { const mockHelp = async (t, { man = { 5: ['npmrc', 'install', 'package-json'], - 1: ['whoami', 'install', 'star', 'unstar', 'uninstall', 'unpublish'].map(p => `npm-${p}`), + 1: ['whoami', 'install', 'uninstall', 'unpublish'].map(p => `npm-${p}`), 7: ['disputes', 'config'], }, browser = false, @@ -153,9 +153,9 @@ t.test('npm help package.json redirects to package-json', async t => { t.match(spawnArgs[0], /package-json\.5$/) }) -t.test('npm help ?(un)star', async t => { +t.test('npm help ?(un)publish with woman', async t => { const { getArgs } = await mockHelp(t, { - exec: ['?(un)star'], + exec: ['?(un)publish'], woman: true, }) @@ -163,7 +163,7 @@ t.test('npm help ?(un)star', async t => { t.equal(spawnBin, 'emacsclient', 'maps woman to emacs correctly') t.equal(spawnArgs.length, 2) t.match(spawnArgs[1], /^\(woman-find-file '/) - t.match(spawnArgs[1], /npm-star.1'\)$/) + t.match(spawnArgs[1], /npm-unpublish.1'\)$/) }) t.test('npm help un*', async t => { diff --git a/test/lib/commands/star.js b/test/lib/commands/star.js deleted file mode 100644 index c5f233f01cc4a..0000000000000 --- a/test/lib/commands/star.js +++ /dev/null @@ -1,61 +0,0 @@ -const t = require('tap') -const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') -const MockRegistry = require('@npmcli/mock-registry') - -const pkgName = '@npmcli/test-package' -const authToken = 'test-auth-token' -const username = 'test-user' -const auth = { '//registry.npmjs.org/:_authToken': authToken } - -t.test('no args', async t => { - const { npm } = await loadMockNpm(t) - await t.rejects( - npm.exec('star', []), - { code: 'EUSAGE' }, - 'should throw usage error' - ) -}) - -t.test('first person to star a package unicode:false', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { - config: { unicode: false, ...auth }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), - authorization: authToken, - }) - const manifest = registry.manifest({ name: pkgName }) - await registry.package({ manifest, query: { write: true } }) - registry.whoami({ username }) - registry.star(manifest, { [username]: true }) - - await npm.exec('star', [pkgName]) - t.equal( - joinedOutput(), - '(*) @npmcli/test-package', - 'should output starred package msg' - ) -}) - -t.test('second person to star a package unicode:true', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { - config: { unicode: true, ...auth }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), - authorization: authToken, - }) - const manifest = registry.manifest({ name: pkgName, users: { otheruser: true } }) - await registry.package({ manifest, query: { write: true } }) - registry.whoami({ username }) - registry.star(manifest, { otheruser: true, [username]: true }) - - await npm.exec('star', [pkgName]) - t.equal( - joinedOutput(), - '★ @npmcli/test-package', - 'should output starred package msg' - ) -}) diff --git a/test/lib/commands/stars.js b/test/lib/commands/stars.js deleted file mode 100644 index fc38ca77ac781..0000000000000 --- a/test/lib/commands/stars.js +++ /dev/null @@ -1,127 +0,0 @@ -const t = require('tap') -const realFetch = require('npm-registry-fetch') -const mockNpm = require('../../fixtures/mock-npm') - -const noop = () => {} - -const mockStars = async (t, { npmFetch = noop, exec = true, ...opts }) => { - const mock = await mockNpm(t, { - command: 'stars', - exec, - mocks: { - 'npm-registry-fetch': Object.assign(noop, realFetch, { json: npmFetch }), - '{LIB}/utils/get-identity.js': async () => 'foo', - }, - ...opts, - }) - - return { - ...mock, - result: mock.stars.output, - logs: () => mock.logs.byTitle('stars'), - } -} - -t.test('no args', async t => { - t.plan(3) - - const npmFetch = async (uri, opts) => { - t.equal(uri, '/-/_view/starredByUser', 'should fetch from expected uri') - t.equal(opts.query.key, '"foo"', 'should match logged in username') - - return { - rows: [ - { value: '@npmcli/arborist' }, - { value: '@npmcli/map-workspaces' }, - { value: 'libnpmfund' }, - { value: 'libnpmpublish' }, - { value: 'ipt' }, - ], - } - } - - const { result } = await mockStars(t, { npmFetch }) - - t.matchSnapshot( - result, - 'should output a list of starred packages' - ) -}) - -t.test('npm star ', async t => { - t.plan(3) - - const npmFetch = async (uri, opts) => { - t.equal(uri, '/-/_view/starredByUser', 'should fetch from expected uri') - t.equal(opts.query.key, '"ruyadorno"', 'should match username') - - return { - rows: [{ value: '@npmcli/arborist' }], - } - } - - const { result } = await mockStars(t, { npmFetch, exec: ['ruyadorno'] }) - - t.match( - result, - '@npmcli/arborist', - 'should output expected list of starred packages' - ) -}) - -t.test('unauthorized request', async t => { - const npmFetch = async () => { - throw Object.assign( - new Error('Not logged in'), - { code: 'ENEEDAUTH' } - ) - } - - const { joinedOutput, stars, logs } = await mockStars(t, { npmFetch, exec: false }) - - await t.rejects( - stars.exec([]), - /Not logged in/, - 'should throw unauthorized request msg' - ) - - t.strictSame( - logs(), - ['stars auth is required to look up your username'], - 'should warn auth required msg' - ) - - t.equal( - joinedOutput(), - '', - 'should have empty output' - ) -}) - -t.test('unexpected error', async t => { - const npmFetch = async () => { - throw new Error('ERROR') - } - - const { stars, logs } = await mockStars(t, { npmFetch, exec: false }) - - await t.rejects( - stars.exec([]), - /ERROR/, - 'should throw unexpected error message' - ) - - t.strictSame(logs(), [], 'no logs') -}) - -t.test('no pkg starred', async t => { - const npmFetch = async () => ({ rows: [] }) - - const { logs } = await mockStars(t, { npmFetch }) - - t.strictSame( - logs(), - ['stars user has not starred any packages'], - 'should warn no starred packages msg' - ) -}) diff --git a/test/lib/commands/unstar.js b/test/lib/commands/unstar.js deleted file mode 100644 index ee31428546d06..0000000000000 --- a/test/lib/commands/unstar.js +++ /dev/null @@ -1,62 +0,0 @@ -const t = require('tap') -const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') -const MockRegistry = require('@npmcli/mock-registry') - -const pkgName = '@npmcli/test-package' -const authToken = 'test-auth-token' -const username = 'test-user' -const auth = { '//registry.npmjs.org/:_authToken': authToken } - -t.test('no args', async t => { - const { npm } = await loadMockNpm(t) - await t.rejects( - npm.exec('unstar', []), - { code: 'EUSAGE' }, - 'should throw usage error' - ) -}) - -t.test('unstar a package unicode:false', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { - config: { unicode: false, ...auth }, - }) - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), - authorization: authToken, - }) - const manifest = registry.manifest({ name: pkgName, users: { [username]: true } }) - await registry.package({ manifest, query: { write: true } }) - registry.whoami({ username }) - registry.star(manifest, {}) - - await npm.exec('unstar', [pkgName]) - t.equal( - joinedOutput(), - '( ) @npmcli/test-package', - 'should output unstarred package msg' - ) -}) - -t.test('unstar a package unicode:true', async t => { - const { npm, joinedOutput } = await loadMockNpm(t, { - config: { unicode: true, ...auth }, - }) - - const registry = new MockRegistry({ - tap: t, - registry: npm.config.get('registry'), - authorization: authToken, - }) - const manifest = registry.manifest({ name: pkgName, users: { [username]: true } }) - await registry.package({ manifest, query: { write: true } }) - registry.whoami({ username }) - registry.star(manifest, {}) - - await npm.exec('unstar', [pkgName]) - t.equal( - joinedOutput(), - '☆ @npmcli/test-package', - 'should output unstarred package msg' - ) -})