MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / main

Function main

packages/server-e2e/scripts/run-scenarios.ts:18–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16const tsxBin = process.platform === 'win32' ? 'tsx.cmd' : 'tsx';
17
18async function main(): Promise<void> {
19 const reportDir = defaultReportDir();
20 resetReportDir(reportDir);
21
22 const scenarios = readdirSync(scenariosDir)
23 .filter((file) => file.endsWith('.ts'))
24 .toSorted();
25
26 let failed = false;
27 for (const file of scenarios) {
28 const caseName = file.slice(0, -'.ts'.length);
29 const scenarioPath = join('scenarios', file);
30 process.stdout.write(`▶ ${scenarioPath}\n`);
31 recordReportEvent(
32 { kind: 'log', caseName, label: 'scenario started', value: { file: scenarioPath } },
33 { reportDir },
34 );
35
36 const result = await runScenario(file, caseName, reportDir);
37 recordReportEvent(
38 {
39 kind: 'test-result',
40 caseName,
41 state: result.exitCode === 0 ? 'passed' : 'failed',
42 error: result.exitCode === 0 ? undefined : { exitCode: result.exitCode },
43 },
44 { reportDir },
45 );
46 if (result.exitCode !== 0) {
47 failed = true;
48 break;
49 }
50 }
51
52 const htmlPath = writeHtmlReport({
53 reportDir,
54 title: `server-e2e scenarios (${failed ? 'failed' : 'passed'})`,
55 });
56 process.stdout.write(`[server-e2e] HTML report: ${htmlPath}\n`);
57 if (failed) process.exit(1);
58}
59
60async function runScenario(
61 file: string,

Callers 1

run-scenarios.tsFile · 0.70

Calls 7

defaultReportDirFunction · 0.85
resetReportDirFunction · 0.85
recordReportEventFunction · 0.85
runScenarioFunction · 0.85
writeHtmlReportFunction · 0.85
writeMethod · 0.65
exitMethod · 0.65

Tested by

no test coverage detected