Skip to content

test(tests): migrate claude CLI task tests from Python to TypeScript#261

Open
m-golovchin wants to merge 6 commits into
codemie-ai:mainfrom
m-golovchin:test/migrate-claude-cli-integration-tests
Open

test(tests): migrate claude CLI task tests from Python to TypeScript#261
m-golovchin wants to merge 6 commits into
codemie-ai:mainfrom
m-golovchin:test/migrate-claude-cli-integration-tests

Conversation

@m-golovchin
Copy link
Copy Markdown

Summary

Migrates test_codemie_cli_claude.py from the Python test harness to a TypeScript/Vitest integration test suite. Adds Zod schema validation for the three session file types written by codemie-claude (session JSON, metrics JSONL, conversation JSONL). Also fixes two pre-existing issues in package.json.

Changes

  • tests/integration/claude-cli-task.test.ts — Full port of the Python E2E test: installs codemie/Claude (skipped by default via env flags), writes an sso-autotest profile, runs codemie-claude --task, then polls for and validates all three session files using Zod schemas.
  • tests/integration/models/ — Three new Zod schema files (session.ts, metrics.ts, conversation.ts) modelling the session data structures with .passthrough() for forward compatibility.
  • package.json — lint script fix: replaced single-quoted glob '{src,tests}/**/*.ts' with "src/**/*.ts" "tests/**/*.ts" — single quotes are treated as literal characters by cmd.exe on Windows, breaking ESLint.
  • package.json — lint-staged fix: scoped vitest related --run to src/**/*.ts only, so integration tests (which require live infrastructure) are not executed on every pre-commit.

Impact

Before: ESLint lint script failed on Windows with "No files matching the pattern '{src,tests}/**/*.ts' were found".
After: ESLint works cross-platform; integration tests only run in CI (npm run test:integration), not on pre-commit.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

MaksymHolovchyn and others added 3 commits April 23, 2026 13:30
Port test_codemie_cli_claude.py to Vitest with Zod schema validation for
session, metrics, and conversation JSONL files. Fix cross-platform ESLint
glob pattern and scope lint-staged vitest to src/ only so integration tests
don't run on pre-commit.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…test

Replace broad src/**/*.ts lint-staged scope with targeted --exclude on the
claude-cli-task test which requires live infrastructure to run.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Replace lint-staged --exclude hack with describe.runIf(INCLUDE_SSO_TESTS)
so the test is skipped by default and only runs when explicitly enabled.
Add .env.test.local.example documenting required env vars.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Comment thread .env.test.local.example Outdated
Comment thread .env.test.local.example Outdated
Comment thread .env.test.local.example Outdated
Comment thread .env.test.local.example Outdated
MaksymHolovchyn and others added 3 commits April 24, 2026 13:57
Replace global codemie-claude binary invocation with node ./bin/codemie-claude.js
so the test always runs against the current branch source. Add auto-rebuild in
beforeAll to guarantee dist/ is up to date. Remove installation steps for
@codemieai/code and claude provider that required manual user setup.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Claude fires "codemie hook" via hooks.json during session lifecycle.
Without a global binary in PATH the hooks silently fail and no session
files are written. Running npm link after build makes the local binaries
globally available, replacing any previously installed version.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
@codemie-ai
Copy link
Copy Markdown
Owner

[AUTO_CLOSE_WARNING] ⏰ This pull request is older than 14 days and will be automatically closed in 16 more days (when it reaches 30 days old)! To maintain this PR, either convert it to Draft or complete your changes and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants