Add integration tests in sandboxed environment (#73)#78
Open
titouanmathis wants to merge 5 commits intomainfrom
Open
Add integration tests in sandboxed environment (#73)#78titouanmathis wants to merge 5 commits intomainfrom
titouanmathis wants to merge 5 commits intomainfrom
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— lightweighthttp.createServerapp serving canned JSON:API fixtures. ValidatesX-Auth-Token+X-Organization-Idheaders. Per-test error overrides viasetError().tests/integration/helpers/sandbox.ts— creates a temp dir tree (home/,config/,cache/). Builds a locked-down child process env — NO...process.envspread. Credentials injected via env vars to short-circuit keychain.tests/integration/helpers/cli-runner.ts— spawns the realpackages/cli/dist/cli.jsbinary in the sandbox vianode:child_process.execFile.tests/integration/helpers/mcp-client.ts— wraps@modelcontextprotocol/sdk'sStdioClientTransport+Clientfor stdio tests; rawfetchfor HTTP tests.Fixtures
Static JSON:API files in
tests/integration/fixtures/:projects-list.json,projects-get.jsontasks-list.jsontime-entries-list.jsonpeople-list.jsonTests (33 total, ~4s)
cli/help.test.ts--help, subcommand helpcli/config.test.tsconfig get/set/validatecli/projects.test.tscli/time.test.tsmcp/stdio.test.tsmcp/http.test.tsAlso
packages/mcp/src/handlers/index.ts— addedbaseUrl: process.env.PRODUCTIVE_BASE_URLtoProductiveApiconfig inexecuteToolWithCredentials(HTTP transport was missing this, stdio already worked viagetConfig())package.json— addedtest:integration,test:integration:watch,test:allscripts.github/workflows/ci.yml— addedintegration-testjob (needs build artifacts, runs after build, included inci-pass)