Skip to content

Commit

Permalink
delete the contents of node_modules only
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Oct 29, 2020
1 parent 84d7123 commit f00d475
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ci = async () => {
'later to generate a package-lock.json file, then try again.'
throw new Error(msg)
}),
rimraf(`${where}/node_modules/`),
rimraf(`${where}/node_modules/*`, { glob: { dot: true, nosort: true, silent: true } }),
])
// npm ci should never modify the lockfile or package.json
await arb.reify({ save: false })
Expand Down
3 changes: 2 additions & 1 deletion test/lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ test('should remove existing node_modules before installing', (t) => {
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')
const nodeModules = contents.filter((path) => path.startsWith('node_modules'))
t.same(nodeModules, ['node_modules'], 'should only have the node_modules directory')
t.end()
}
}
Expand Down

0 comments on commit f00d475

Please sign in to comment.