Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly open package arg repo inside workspace #5154

Merged
merged 1 commit into from Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/package-url-cmd.js
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
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')
})
})