-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Remove ssrError when invalidating a module (#8124)
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/vite/src/node/server/__tests__/moduleGraph.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { beforeEach, describe, expect, it } from 'vitest' | ||
import { ModuleGraph } from '../moduleGraph' | ||
let moduleGraph: ModuleGraph | ||
|
||
describe('moduleGraph', () => { | ||
describe('invalidateModule', () => { | ||
beforeEach(() => { | ||
moduleGraph = new ModuleGraph((id) => Promise.resolve({ id })) | ||
}) | ||
|
||
it('removes an ssrError', async () => { | ||
const entryUrl = '/x.js' | ||
|
||
const entryModule = await moduleGraph.ensureEntryFromUrl(entryUrl, false) | ||
entryModule.ssrError = new Error(`unable to execute module`) | ||
|
||
expect(entryModule.ssrError).to.be.a('error') | ||
moduleGraph.invalidateModule(entryModule) | ||
expect(entryModule.ssrError).toBe(null) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters