Skip to content

Commit

Permalink
fix removeModules
Browse files Browse the repository at this point in the history
  • Loading branch information
jsumners-nr committed Apr 24, 2024
1 parent bfb2245 commit e349c22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/lib/cache-buster.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ module.exports = {
removeModules(modules = []) {
let removed = 0
const keys = Object.keys(require.cache)
for (const key of keys) {
if (modules.includes(key) === false) {
continue
for (const mod of modules) {
for (const key of keys) {
if (key.includes(mod) === false) {
continue
}
delete require.cache[key]
removed += 1
}
delete require.cache[key]
removed += 1
}
return removed
},
Expand Down

0 comments on commit e349c22

Please sign in to comment.