Skip to content

Add integration tests in sandboxed environment (#73)#78

Open
titouanmathis wants to merge 5 commits intomainfrom
feature/73-integration-tests
Open

Add integration tests in sandboxed environment (#73)#78
titouanmathis wants to merge 5 commits intomainfrom
feature/73-integration-tests

Conversation

@titouanmathis
Copy link
Contributor

Closes #73

What

End-to-end integration tests that exercise the real CLI binary and real MCP server in a sandboxed environment with a mock Productive.io API — no real API calls.

Implementation

Infrastructure

  • tests/integration/helpers/mock-server.ts — lightweight http.createServer app serving canned JSON:API fixtures. Validates X-Auth-Token + X-Organization-Id headers. Per-test error overrides via setError().
  • tests/integration/helpers/sandbox.ts — creates a temp dir tree (home/, config/, cache/). Builds a locked-down child process env — NO ...process.env spread. Credentials injected via env vars to short-circuit keychain.
  • tests/integration/helpers/cli-runner.ts — spawns the real packages/cli/dist/cli.js binary in the sandbox via node:child_process.execFile.
  • tests/integration/helpers/mcp-client.ts — wraps @modelcontextprotocol/sdk's StdioClientTransport + Client for stdio tests; raw fetch for HTTP tests.

Fixtures

Static JSON:API files in tests/integration/fixtures/:

  • projects-list.json, projects-get.json
  • tasks-list.json
  • time-entries-list.json
  • people-list.json

Tests (33 total, ~4s)

File Tests What
cli/help.test.ts 5 --help, subcommand help
cli/config.test.ts 4 config get/set/validate
cli/projects.test.ts 8 list/get, JSON format, aliases, 401/500 errors
cli/time.test.ts 4 list, JSON format, alias, 401 error
mcp/stdio.test.ts 6 listTools, listPrompts, callTool (projects + time), error resource
mcp/http.test.ts 6 health, initialize, tools/list, tools/call, 401, unknown method

Also

  • packages/mcp/src/handlers/index.ts — added baseUrl: process.env.PRODUCTIVE_BASE_URL to ProductiveApi config in executeToolWithCredentials (HTTP transport was missing this, stdio already worked via getConfig())
  • package.json — added test:integration, test:integration:watch, test:all scripts
  • .github/workflows/ci.yml — added integration-test job (needs build artifacts, runs after build, included in ci-pass)

titouanmathis and others added 5 commits February 18, 2026 15:34
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.75%. Comparing base (5330128) to head (090b486).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #78   +/-   ##
=======================================
  Coverage   93.75%   93.75%           
=======================================
  Files         197      197           
  Lines        6723     6723           
  Branches     2182     2215   +33     
=======================================
  Hits         6303     6303           
  Misses        415      415           
  Partials        5        5           
Flag Coverage Δ
unittests 93.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Integration tests in sandboxed environment

1 participant

Comments