Skip to content

Commit b70511d

Browse files
authored
Merge pull request #971 from dyoshikawa/fix/improve-e2e-test-robustness
fix: improve e2e test robustness with stderr diagnostics and safe cleanup default
2 parents 10734e1 + c6bbaa0 commit b70511d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/e2e/e2e-helper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export async function runGenerate({
6767
*/
6868
export function useTestDirectory(): { getTestDir: () => string } {
6969
let testDir = "";
70-
let cleanup: () => Promise<void>;
70+
// oxlint-disable-next-line unicorn/consistent-function-scoping -- default avoids undefined if beforeEach fails
71+
let cleanup: () => Promise<void> = async () => {};
7172

7273
beforeEach(async () => {
7374
({ testDir, cleanup } = await setupTestDirectory());

src/e2e/e2e-mcp.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ describe("E2E: mcp", () => {
5353
});
5454

5555
let hasError = false;
56+
let stderrOutput = "";
5657

5758
// Collect stderr output and check for actual errors
5859
mcpProcess.stderr?.on("data", (data) => {
5960
const output = data.toString();
61+
stderrOutput += output;
6062
// Check if the output contains actual error messages (not just warnings)
6163
if (output.toLowerCase().includes("error") && !output.includes("warning")) {
6264
hasError = true;
@@ -75,6 +77,6 @@ describe("E2E: mcp", () => {
7577
});
7678

7779
// Verify that there were no actual errors (warnings are acceptable)
78-
expect(hasError).toBe(false);
80+
expect(hasError, `MCP daemon produced errors: ${stderrOutput}`).toBe(false);
7981
});
8082
});

0 commit comments

Comments
 (0)