Skip to content

Commit

Permalink
fix: specific mocha binary filters when blasting cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartones authored and Diego Muñoz Pérez committed Jul 7, 2024
1 parent 7f26597 commit 9df2bf1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/cli/watch-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,12 @@ const eraseLine = () => {
const blastCache = (watcher, blastAll) => {
if (blastAll) {
Object.keys(require.cache)
// Avoid deleting mocha binary (at minimum, breaks Mocha's watch tests)
.filter(file => !file.includes('/mocha/bin/'))
// Avoid deleting mocha binary
.filter(
file =>
!file.includes('mocha/bin/mocha.js') &&
!file.includes('mocha/lib/mocha.js')
)
.forEach(file => {
delete require.cache[file];
});
Expand Down

0 comments on commit 9df2bf1

Please sign in to comment.