Skip to content

Commit 201152d

Browse files
chargomeclaude
andcommitted
fix(nextjs): Pre-warm module cache in conflictingDebugOptions test to prevent CI timeout
The first dynamic import after vi.resetModules() needs to compile the entire SDK module graph from scratch, which can hang on slower CI runners. Pre-importing the modules in beforeAll warms the V8 compilation cache. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5d41858 commit 201152d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/nextjs/test/config/conflictingDebugOptions.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ describe('debug: true + removeDebugLogging warning', () => {
2020
let originalLocation: unknown;
2121
let originalAddEventListener: unknown;
2222

23-
beforeAll(() => {
23+
beforeAll(async () => {
24+
// Pre-warm V8 compilation cache for the large SDK module graphs.
25+
// Without this, the first dynamic import after vi.resetModules() can hang
26+
// because vitest needs to compile the entire module graph from scratch.
27+
await import('../../src/client/index.js');
28+
await import('../../src/server/index.js');
29+
await import('../../src/edge/index.js');
30+
vi.resetModules();
31+
2432
dom = new JSDOM('<!doctype html><html><head></head><body></body></html>', { url: 'https://example.com/' });
2533

2634
originalDocument = (globalThis as any).document;

0 commit comments

Comments
 (0)