Skip to content

Commit

Permalink
npm ci should never save package.json or lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Sep 16, 2020
1 parent ecd42ce commit 24f3a54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const ci = async () => {
}),
rimraf(`${where}/node_modules/`)
])
await arb.reify()
// npm ci should never modify the lockfile or package.json
await arb.reify({ save: false })
reifyOutput(arb)
}

Expand Down
3 changes: 2 additions & 1 deletion test/lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ test('should remove existing node_modules before installing', (t) => {
},
'@npmcli/arborist': function () {
this.loadVirtual = () => Promise.resolve(true)
this.reify = async () => {
this.reify = async (options) => {
t.equal(options.save, false, 'npm ci should never save')
// check if node_modules was removed before reifying
const contents = await readdir(testDir)
t.equals(contents.indexOf('node_modules'), -1, 'node_modules does not exist')
Expand Down

0 comments on commit 24f3a54

Please sign in to comment.