Skip to content

Commit 9e66c96

Browse files
authored
fix(web-integration): update overrideAIConfig to use extendMode for merging configurations (#1048)
1 parent 8dad93a commit 9e66c96

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

packages/web-integration/src/playground/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const setup = async () => {
2828
const { parsed } = dotenv.config();
2929

3030
if (parsed) {
31-
overrideAIConfig(parsed);
31+
// Use extendMode to merge with existing config instead of replacing it
32+
overrideAIConfig(parsed, true);
3233
}
3334
}
3435
};

packages/web-integration/tests/ai/web/static/static-page.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { join } from 'node:path';
33
import { StaticPageAgent } from '@/playground/agent';
44
import PlaygroundServer from '@/playground/server';
55
import StaticPage from '@/playground/static-page';
6-
import { allConfigFromEnv } from '@midscene/shared/env';
7-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
6+
import { afterEach, describe, expect, it, vi } from 'vitest';
87

98
const dumpFilePath = join(__dirname, '../../fixtures/ui-context.json');
109
const context = readFileSync(dumpFilePath, { encoding: 'utf-8' });
@@ -34,17 +33,8 @@ describe(
3433
});
3534

3635
it('server should work', async () => {
37-
// Save current config before creating server
38-
const currentConfig = (globalThis as any).midsceneGlobalConfig;
39-
4036
server = new PlaygroundServer(StaticPage, StaticPageAgent);
4137

42-
// Restore config after server creation in case it was cleared
43-
if (!(globalThis as any).midsceneGlobalConfig ||
44-
Object.keys((globalThis as any).midsceneGlobalConfig || {}).length === 0) {
45-
(globalThis as any).midsceneGlobalConfig = currentConfig || allConfigFromEnv();
46-
}
47-
4838
await server.launch();
4939

5040
const port = server.port;

0 commit comments

Comments
 (0)