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(diff): set option "where" for pacote #2822

Merged
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
9 changes: 5 additions & 4 deletions lib/diff.js
Expand Up @@ -50,10 +50,11 @@ class Diff {
const [a, b] = await this.retrieveSpecs(specs)
npmlog.info('diff', { src: a, dst: b })

const res = await libdiff(
[a, b],
{ ...this.npm.flatOptions, diffFiles: args }
)
const res = await libdiff([a, b], {
...this.npm.flatOptions,
diffFiles: args,
where: this.where,
})
return output(res)
}

Expand Down
3 changes: 2 additions & 1 deletion test/lib/diff.js
Expand Up @@ -951,12 +951,13 @@ t.test('first arg is a valid semver range', t => {

t.test('first arg is an unknown dependency name', t => {
t.test('second arg is a qualified spec', t => {
t.plan(3)
t.plan(4)

libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'bar@latest', 'should set expected first spec')
t.equal(b, 'bar@2.0.0', 'should set expected second spec')
t.match(opts, npm.flatOptions, 'should forward flat options')
t.match(opts, { where: '.' }, 'should forward pacote options')
}

npm.flatOptions.diff = ['bar', 'bar@2.0.0']
Expand Down