فهرست منبع

fix(tests): api-client.ts 读 BACKEND_URL env, 修 port 3000/3100 错位

CONTRIBUTING.md 要求发布前必跑核心业务测试。
修复前: tests/helpers/api-client.ts:7 硬编码 http://127.0.0.1:3000,
        .env 默认端口 3000 (与 .env.production 3100 不同),
        apiClient 用 3000 拼 baseURL。
        实际后端跑在 3000 应该是 OK 的, 但若有人用 SERVER_PORT=3100
        启动, beforeAll 探 /health 失败, 9 个 CORE-* 全 skip
        (既不 pass 也不 fail, 永真绿)。

修复: BASE_URL = process.env.BACKEND_URL || 'http://127.0.0.1:3000'
      接受 run-core-business-test.sh 通过 env 注入的 BACKEND_URL。

验证: ./scripts/run-core-business-test.sh (BACKEND_URL=http://127.0.0.1:3000)
      8 passed + 1 designed-skip (CORE-4 best-effort audio 90s 超时), 3.1m。

#core-business-test-infra
MyFramework User 2 ماه پیش
والد
کامیت
e71683d104
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      tests/helpers/api-client.ts

+ 1 - 1
tests/helpers/api-client.ts

@@ -4,7 +4,7 @@
  */
 import { request, APIRequestContext } from '@playwright/test';
 
-const BASE_URL = 'http://127.0.0.1:3000';
+const BASE_URL = process.env.BACKEND_URL || 'http://127.0.0.1:3000';
 
 let apiContext: APIRequestContext;
 let authToken: string | null = null;