Skip to content

test(mcp): build both targets inside test so a stale dist cannot pass - #10

Merged
timeleft-- merged 1 commit into
developfrom
claude/issue-335-q5-test-builds
Nov 5, 2026
Merged

timeleft-- merged 1 commit into
developfrom
claude/issue-335-q5-test-builds

Conversation

@timeleft--

Copy link
Copy Markdown
Member

Answers Q5 of iaser-ai#335.

What was wrong

The MCP tests run the built artifacts: dist/server/index.js, dist/view.html and the Workers bundle. pnpm mcp test ran them without building, so after a source change they passed against the old build.

Shown on this branch before the change: I built, then made src/node/index.ts throw on import. The old pnpm test passed all 154 tests. The new one rebuilds and fails on the thrown error.

Change

  • test runs build and build:worker before the tests.

  • verify no longer runs its own build steps, so it builds each target once.

  • In apps/mcp/turbo.json:

    • test drops its build and build:worker dependencies, and declares dist/** and dist-worker/** as its outputs.
    • test:browser now depends on test instead of build.

    Together these keep a single Turbo run from building in two tasks at once, and let a cache hit on test restore the build that test:browser reads.

  • The README says test builds first and that test:browser reads the build without making one.

No version bump: this changes only test wiring and docs.

Verification

  • pnpm mcp verify passed: 154 tests and 78 browser checks. Each target was built once.
  • turbo run test test:browser --filter ansari-mcp --force ran test, then test:browser, and both passed.
  • Then I deleted dist/ and dist-worker/ and ran turbo run test:browser. test was a cache hit that restored the build, and the 78 browser checks passed.

pnpm mcp test:browser run on its own still reads whatever is in dist/. That is unchanged and documented.

🤖 Generated with Claude Code

The tests run the built artifacts (dist/server/index.js, dist/view.html and
the Workers bundle), but `pnpm mcp test` ran them without building. With a
source change and an old dist/, every test passed against the old build:
with src/node/index.ts throwing on import, the old command passed 154/154,
and the new one fails.

`test` now runs build and build:worker first. Turbo's test task drops its
separate build dependencies, and `verify` drops its build steps, so nothing
builds twice. test:browser now runs after test, and test declares dist/ and
dist-worker/ as outputs, so one Turbo run never builds in two tasks at once
and a cache hit restores the build.

Answers ansari#335 Q5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@yia-mw-agent yia-mw-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full merge-base-to-head diff (base develop 396b091 = merge-base, 3 files) at 69dba4e. No material defects.

Helmet-Review-Request: #10 (comment)

What I checked:

  • apps/mcp/package.json: test now runs build and build:worker before the tests, and verify drops its own build steps, so each target is built once. The root test script excludes ansari-mcp, so no other job is affected.
  • apps/mcp/turbo.json: test drops its build dependencies and declares dist/** and dist-worker/** as outputs; test:browser depends on test. This avoids two Turbo tasks building at once and lets a cache hit restore the build.
  • apps/mcp/README.md matches the new behaviour.

Validation at this exact head (apps/mcp): lint and typecheck pass; pnpm test rebuilt both targets and passed 154/154; test:browser passed 78 checks with no errors. Under Turbo (turbo run test test:browser --filter ansari-mcp --env-mode=loose): test ran, then test:browser passed. After moving dist/ and dist-worker/ aside, turbo run test:browser showed test as a cache hit that restored both directories, and the 78 checks passed. This matches the PR description. CI checks (MCP application, api, auth, frontend, gitleaks) are green. Live head matched 69dba4e at start and before submission.

Non-blocking: under Turbo's default strict env mode, test:browser does not see PLAYWRIGHT_BROWSERS_PATH. That only mattered in my sandbox (a non-default browser cache) and is unchanged by this PR.

@timeleft--
timeleft-- merged commit 9d9c2ad into develop Nov 5, 2026
5 checks passed
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.

2 participants