Skip to content

Commit 0a3b9c9

Browse files
committed
refactor(vite): update virtual module initialization and payload structure\n\n- Modified the virtual module to call initBrowserEcho with a JSON payload, enhancing clarity in the configuration.\n- Updated test assertions to reflect the new payload structure, ensuring accurate validation of the browser echo initialization.
1 parent 0c811a4 commit 0a3b9c9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/vite/test/plugin.config.smoke.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ describe('Vite plugin configuration (smoke)', () => {
3737
const rid = (p as any).resolveId?.('virtual:browser-echo');
3838
const code: string = (p as any).load?.(rid);
3939
expect(typeof code).toBe('string');
40-
// Default route and merged batch values appear in the virtual module
41-
expect(code).toContain('const ROUTE = "/__client-logs"');
42-
expect(code).toContain('const BATCH_SIZE = 99');
43-
expect(code).toContain('const BATCH_INTERVAL = 300');
40+
// Virtual module now calls initBrowserEcho with JSON payload
41+
expect(code).toContain('initBrowserEcho(');
42+
expect(code).toContain('"route":"/__client-logs"');
43+
expect(code).toContain('"batch":{"size":99,"interval":300}');
4444
});
4545

4646
it('forwards to MCP and suppresses terminal when MCP URL is set', async () => {
@@ -115,8 +115,9 @@ describe('Vite plugin configuration (smoke)', () => {
115115
const p = browserEcho({ include: ['error'], route: '/__client-logs' });
116116
const rid = (p as any).resolveId?.('virtual:browser-echo');
117117
const code: string = (p as any).load?.(rid);
118-
expect(code).toContain('const INCLUDE = ["error"]');
119-
expect(code).toContain('const ROUTE = "/__client-logs"');
118+
expect(code).toContain('initBrowserEcho(');
119+
expect(code).toContain('"include":["error"]');
120+
expect(code).toContain('"route":"/__client-logs"');
120121
expect(code).not.toContain('BROWSER_ECHO_MCP');
121122
});
122123
});

0 commit comments

Comments
 (0)