Skip to content

Commit b674c71

Browse files
committed
fix(diff): set option where for pacote
pacote expects a **where** option that sets the cwd for all its operations, ref: https://github.com/npm/pacote#options This change properly sets that option in libnpmdiff options that will then properly forward it to pacote, this is specially important for when reading local file system specs.
1 parent 0c881fc commit b674c71

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/diff.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ const diff = async (args) => {
4242
const [a, b] = await retrieveSpecs(specs)
4343
npmlog.info('diff', { src: a, dst: b })
4444

45-
const res = await libdiff([a, b], { ...npm.flatOptions, diffFiles: args })
45+
const res = await libdiff([a, b], {
46+
...npm.flatOptions,
47+
diffFiles: args,
48+
where: where(),
49+
})
4650
return output(res)
4751
}
4852

test/lib/diff.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,13 @@ t.test('first arg is a valid semver range', t => {
946946

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

951951
libnpmdiff = async ([a, b], opts) => {
952952
t.equal(a, 'bar@latest', 'should set expected first spec')
953953
t.equal(b, '[email protected]', 'should set expected second spec')
954954
t.match(opts, npm.flatOptions, 'should forward flat options')
955+
t.match(opts, { where: '.' }, 'should forward pacote options')
955956
}
956957

957958
npm.flatOptions.diff = ['bar', '[email protected]']

0 commit comments

Comments
 (0)