Skip to content

Commit 823f99d

Browse files
committed
fix: pass flatOptions through to Arborist.reify in npm ci
Fixes: #2017 Credit: @darcyclarke Close: #2159 Reviewed-by: @ruyadorno
1 parent b47ada7 commit 823f99d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/ci.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ci = async () => {
3434
rimraf(`${where}/node_modules/*`, { glob: { dot: true, nosort: true, silent: true } }),
3535
])
3636
// npm ci should never modify the lockfile or package.json
37-
await arb.reify({ save: false })
37+
await arb.reify({ ...npm.flatOptions, save: false })
3838
reifyOutput(arb)
3939
}
4040

test/lib/ci.js

+19
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ test('should use Arborist', (t) => {
4242
})
4343
})
4444

45+
test('should pass flatOptions to Arborist.reify', (t) => {
46+
const ci = requireInject('../../lib/ci.js', {
47+
'../../lib/npm.js': {
48+
prefix: 'foo',
49+
flatOptions: {
50+
production: true
51+
}
52+
},
53+
'@npmcli/arborist': function () {
54+
this.loadVirtual = () => Promise.resolve(true)
55+
this.reify = async (options) => {
56+
t.equal(options.production, true, 'should pass flatOptions to Arborist.reify')
57+
t.end()
58+
}
59+
}
60+
})
61+
ci(null, () => {})
62+
})
63+
4564
test('should throw if package-lock.json or npm-shrinkwrap missing', (t) => {
4665
const testDir = t.testdir({
4766
'index.js': 'some contents',

0 commit comments

Comments
 (0)