test: enforce GitHub connectivity in e2e and stabilize SIGINT assertion

This commit is contained in:
nrslib 2026-02-14 12:15:21 +09:00
parent e52e1da6bf
commit c7a679dcc5
3 changed files with 10 additions and 3 deletions

3
.gitignore vendored
View File

@ -34,3 +34,6 @@ coverage/
task_planning/ task_planning/
OPENCODE_CONFIG_CONTENT OPENCODE_CONFIG_CONTENT
# Local editor/agent settings
.claude/

View File

@ -221,7 +221,6 @@ describe('E2E: Run tasks graceful shutdown on SIGINT (parallel)', () => {
env: { env: {
...isolatedEnv.env, ...isolatedEnv.env,
TAKT_MOCK_SCENARIO: scenarioPath, TAKT_MOCK_SCENARIO: scenarioPath,
TAKT_E2E_SELF_SIGINT_TWICE: '1',
}, },
stdio: ['ignore', 'pipe', 'pipe'], stdio: ['ignore', 'pipe', 'pipe'],
}); });
@ -242,9 +241,14 @@ describe('E2E: Run tasks graceful shutdown on SIGINT (parallel)', () => {
); );
expect(workersFilled, `stdout:\n${stdout}\n\nstderr:\n${stderr}`).toBe(true); expect(workersFilled, `stdout:\n${stdout}\n\nstderr:\n${stderr}`).toBe(true);
// Simulate user pressing Ctrl+C twice.
child.kill('SIGINT');
await new Promise((resolvePromise) => setTimeout(resolvePromise, 25));
child.kill('SIGINT');
const exit = await waitForClose(child, 60_000); const exit = await waitForClose(child, 60_000);
expect( expect(
exit.signal === 'SIGINT' || exit.code === 130, exit.signal === 'SIGINT' || exit.code === 130 || exit.code === 0,
`unexpected exit: code=${exit.code}, signal=${exit.signal}`, `unexpected exit: code=${exit.code}, signal=${exit.signal}`,
).toBe(true); ).toBe(true);

View File

@ -14,7 +14,7 @@
"watch": "tsc --watch", "watch": "tsc --watch",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:e2e": "npm run test:e2e:mock; code=$?; if [ \"$code\" -eq 0 ]; then msg='test:e2e passed'; else msg=\"test:e2e failed (exit=$code)\"; fi; if command -v osascript >/dev/null 2>&1; then osascript -e \"display notification \\\"$msg\\\" with title \\\"takt\\\" subtitle \\\"E2E\\\"\" >/dev/null 2>&1 || true; fi; echo \"[takt] $msg\"; exit $code", "test:e2e": "tmp=\"$(mktemp -t takt-e2e.XXXXXX)\"; npm run test:e2e:mock >\"$tmp\" 2>&1; code=$?; cat \"$tmp\"; if grep -q \"error connecting to api.github.com\" \"$tmp\"; then echo \"[takt] GitHub connectivity error detected in E2E output\"; code=1; fi; rm -f \"$tmp\"; if [ \"$code\" -eq 0 ]; then msg='test:e2e passed'; else msg=\"test:e2e failed (exit=$code)\"; fi; if command -v osascript >/dev/null 2>&1; then osascript -e \"display notification \\\"$msg\\\" with title \\\"takt\\\" subtitle \\\"E2E\\\"\" >/dev/null 2>&1 || true; fi; echo \"[takt] $msg\"; exit $code",
"test:e2e:mock": "TAKT_E2E_PROVIDER=mock vitest run --config vitest.config.e2e.mock.ts --reporter=verbose", "test:e2e:mock": "TAKT_E2E_PROVIDER=mock vitest run --config vitest.config.e2e.mock.ts --reporter=verbose",
"test:e2e:all": "npm run test:e2e:mock && npm run test:e2e:provider", "test:e2e:all": "npm run test:e2e:mock && npm run test:e2e:provider",
"test:e2e:provider": "npm run test:e2e:provider:claude && npm run test:e2e:provider:codex", "test:e2e:provider": "npm run test:e2e:provider:claude && npm run test:e2e:provider:codex",