Skip to content

Commit

Permalink
fix: correctly invalidate browser modules when watcher triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Sep 18, 2023
1 parent a453637 commit fdb1e46
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/vitest/src/node/core.ts
Expand Up @@ -596,11 +596,13 @@ export class Vitest {
const updateLastChanged = (id: string) => {
const projects = this.getModuleProjects(id)
projects.forEach(({ server, browser }) => {
const mods = server.moduleGraph.getModulesByFile(id)
mods?.forEach((mod) => {
server.moduleGraph.invalidateModule(mod)
browser?.moduleGraph.invalidateModule(mod)
})
const serverMods = server.moduleGraph.getModulesByFile(id)
serverMods?.forEach(mod => server.moduleGraph.invalidateModule(mod))

if (browser) {
const browserMods = browser.moduleGraph.getModulesByFile(id)
browserMods?.forEach(mod => browser.moduleGraph.invalidateModule(mod))
}
})
}

Expand Down

0 comments on commit fdb1e46

Please sign in to comment.