Skip to content

Commit 5245e16

Browse files
committed
fix: 同步测试代码到新的构建产物命名规则
clash-client-host.ts 的 loadAndExecuteBuild() 未使用与 webpack.base.ts 一致的 clientPrefix() 映射,导致 clash-party 模式读取错误的文件路径 (clash-party-xxx.js 而非 cparty-xxx.js),引发所有 Clash Party 集成测试失败。
1 parent 5518763 commit 5245e16

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/clash-client-host.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import { readFileSync, writeFileSync, unlinkSync } from 'fs';
77
import { execSync } from 'child_process';
88
import { join } from 'path';
99

10+
// 与 webpack.base.ts 中的 clientPrefix() 保持一致
11+
function clientPrefix(client: string): string {
12+
return client === 'clash-party' ? 'cparty' : client;
13+
}
14+
1015
export interface ClashClientHost {
1116
// CFW 环境依赖
1217
axios?: any;
@@ -81,7 +86,7 @@ export function loadAndExecuteBuild(
8186

8287
// 返回一个包装函数,在调用时才通过子进程执行
8388
const mainFunc = (config?: any) => {
84-
const buildPath = join(process.cwd(), 'dist', client, `${client}-${mode}.js`);
89+
const buildPath = join(process.cwd(), 'dist', client, `${clientPrefix(client)}-${mode}.js`);
8590
const tempFile = join(process.cwd(), 'tests', '.temp-test.js');
8691

8792
try {

0 commit comments

Comments
 (0)