Skip to content

Commit

Permalink
fix: properly open package arg repo inside workspace (#5154)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored Jul 12, 2022
1 parent 6e68d23 commit 52ec5ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/package-url-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class PackageUrlCommand extends BaseCommand {
}

async execWorkspaces (args, filters) {
if (args && args.length) {
return this.exec(args)
}
await this.setWorkspaces(filters)
return this.exec(this.workspacePaths)
}
Expand Down
8 changes: 8 additions & 0 deletions test/lib/commands/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,12 @@ t.test('workspaces', async t => {
)
t.match({}, opened, 'opened no repo urls')
})

t.test('package arg and workspace', async (t) => {
npm.config.set('workspace', ['workspace-a'])
await npm.exec('repo', ['.'])
t.match({
'https://github.com/npm/workspaces-test': 1,
}, opened, 'opened url for package arg, not workspace')
})
})

0 comments on commit 52ec5ec

Please sign in to comment.