mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
9602209113
- Added e2e package as a workspace dependency in pnpm-lock.yaml. - Updated globalSetup path in vite.config.ts to point to the new e2e package location. - Enhanced documentation for CLI E2E testing, including architecture layers and triggering conditions. - Refactored test paths and commands in the documentation to align with the new structure. - Removed outdated dataset and auth E2E tests to streamline the test suite. - Updated command references and validation checks in the documentation to reflect recent changes.
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { mkdtempSync } from "fs";
|
|
import { tmpdir } from "os";
|
|
import { dirname, join } from "path";
|
|
import { fileURLToPath } from "url";
|
|
import { parseStdoutJson } from "e2e/output";
|
|
import { runNodeMain, type RunCliResult } from "e2e/runner";
|
|
import {
|
|
isBailianE2EEnabled,
|
|
isChatE2EReady,
|
|
isDashScopeE2EReady,
|
|
isSearchE2EReady,
|
|
} from "e2e/gating";
|
|
import { monorepoRoot } from "e2e/monorepo-root";
|
|
|
|
export {
|
|
isBailianE2EEnabled,
|
|
isChatE2EReady,
|
|
isDashScopeE2EReady,
|
|
isSearchE2EReady,
|
|
monorepoRoot,
|
|
parseStdoutJson,
|
|
};
|
|
export type { RunCliResult };
|
|
|
|
/** `packages/kscli` 根目录 */
|
|
export const kscliPackageRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
|
|
const mainTs = join(kscliPackageRoot, "src", "main.ts");
|
|
|
|
/** 子进程执行 kscli */
|
|
export async function runKscli(
|
|
args: string[],
|
|
envOverrides: NodeJS.ProcessEnv = {},
|
|
): Promise<RunCliResult> {
|
|
return runNodeMain(mainTs, args, {
|
|
cwd: kscliPackageRoot,
|
|
env: {
|
|
BAILIAN_CONFIG_DIR: mkdtempSync(join(tmpdir(), "kscli-test-")),
|
|
...envOverrides,
|
|
},
|
|
});
|
|
}
|