Skip to content

Commit 41bd751

Browse files
Fix test runner: proper exit codes and visible output (#49)
## TLDR Fixed critical bugs in test runner AND achieved 100% coverage in dart_node_mcp by fixing the coverage tool to merge data across test files. ## What Does This Do? ### 1. Coverage Merging Fix (dart_node_mcp: <70% → 100%) **Problem**: dart_node_coverage was only capturing 42/42 lines from server.dart, completely missing mcp_server.dart (111 lines) and stdio_transport.dart (6 lines). Total coverage was <70%. **Root Cause**: Every test file called `writeCoverageFile('coverage/coverage.json')` in tearDownAll, **overwriting** each other's coverage data. The last test to finish would wipe out all previous coverage. **Fix**: Modified `dart_node_coverage/lib/src/runtime.dart` to **merge coverage data** instead of overwriting: - Added `readFileSync` to read existing coverage before writing - Implemented `_mergeData()` to combine line execution counts across test runs - Now accumulates coverage from all test files: 159/159 lines = **100% coverage** ### 2. Test Runner Fixes Fixed two critical bugs in `tools/test.sh`: - Test failures now properly fail the build (exit code 1) - Test output is now visible in real-time while also being logged to files **Bug 1: Silent Failures** Parallel test runner spawned subshells that always exited with code 0. Fixed by adding explicit exit codes. **Bug 2: Hidden Output** All output redirected to log files only. Fixed using `tee -a` to stream to both terminal and files. ## How Do The Tests Prove The Change Works? ### Coverage Verification ```bash cd packages/dart_node_mcp dart run dart_node_coverage:coverage -- \ --project-root . \ --packages dart_node_mcp \ --node-test-runner \ --format lcov --output coverage/lcov.info ``` Results: - server.dart: 42/42 lines (100%) - mcp_server.dart: 111/111 lines (100%) - stdio_transport.dart: 6/6 lines (100%) - **TOTAL: 159/159 lines = 100.0% coverage** ### Test Runner Verification - `./tools/test.sh --tier 1` - All tests pass, exit code 0 - `./tools/test.sh --tier 2` - Fails properly on dart_node_react (needs Chrome), exit code 1 ✅ - `MIN_COVERAGE=99 ./tools/test.sh packages/reflux` - Coverage failure detected, exit code 1 ✅ - All test output now visible in terminal while saved to `logs/*.log` ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent fc95acf commit 41bd751

File tree

16 files changed

+2993
-216
lines changed

16 files changed

+2993
-216
lines changed

.claude/skills/setup-claude/SKILL.md

Lines changed: 0 additions & 75 deletions
This file was deleted.

.claude/skills/setup-playwright/SKILL.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

.claude/skills/setup/SKILL.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
name: setup
3+
description: Install development tools (claude | playwright)
4+
disable-model-invocation: true
5+
allowed-tools: Bash
6+
---
7+
8+
# Setup Development Tools
9+
10+
Install Claude Code CLI with Too Many Cooks extension OR Playwright with Chromium.
11+
12+
**Usage**: `/setup <tool>`
13+
- `claude` — Install Claude Code CLI and Too Many Cooks VSCode extension
14+
- `playwright` — Install Chromium and Playwright for website E2E testing
15+
16+
---
17+
18+
## Claude Setup
19+
20+
Sets up Claude Code CLI and the Too Many Cooks VSCode extension for multi-agent coordination.
21+
22+
### Step 1: Install Claude Code CLI
23+
24+
```bash
25+
npm install -g @anthropic-ai/claude-code
26+
```
27+
28+
Verify:
29+
```bash
30+
claude --version
31+
```
32+
33+
### Step 2: Build the Too Many Cooks VSCode Extension
34+
35+
The extension provides visual agent coordination (locks, messages, plans) via the MCP server.
36+
37+
#### 2a. Build the MCP Server first
38+
39+
```bash
40+
cd examples/too_many_cooks && dart pub get && npm install
41+
dart compile js -o examples/too_many_cooks/build/bin/server.js examples/too_many_cooks/bin/server.dart
42+
dart run tools/build/add_preamble.dart \
43+
examples/too_many_cooks/build/bin/server.js \
44+
examples/too_many_cooks/build/bin/server_node.js \
45+
--shebang
46+
```
47+
48+
#### 2b. Build and package the extension
49+
50+
```bash
51+
cd examples/too_many_cooks_vscode_extension
52+
npm install
53+
npm run compile
54+
npx @vscode/vsce package
55+
```
56+
57+
This creates a `.vsix` file in `examples/too_many_cooks_vscode_extension/`.
58+
59+
#### 2c. Install the extension
60+
61+
```bash
62+
code --install-extension examples/too_many_cooks_vscode_extension/*.vsix
63+
```
64+
65+
Or use the full build script that does steps 2a-2b:
66+
```bash
67+
bash examples/too_many_cooks_vscode_extension/build.sh
68+
```
69+
70+
### Step 3: Configure Claude Code for this project
71+
72+
The project's `.claude/settings.local.json` already has the required permissions:
73+
- `Bash(dart pub get:*)` — dependency installation
74+
- `mcp__too-many-cooks__register` — MCP agent registration
75+
- `Bash(docker ps:*)` — Docker status checks
76+
77+
Custom skills are in `.claude/skills/` — run `/help` to see them.
78+
79+
### Multi-Agent Usage
80+
81+
After setup, agents coordinate via the Too Many Cooks MCP server:
82+
- **Lock files** before editing, unlock after
83+
- **Check messages** regularly between agents
84+
- **Update plans** so other agents can see your intent
85+
- Keep your agent key — it's critical for authentication
86+
87+
---
88+
89+
## Playwright Setup
90+
91+
Sets up Playwright with Chromium for running the website's E2E test suite.
92+
93+
### Steps
94+
95+
1. **Install website npm dependencies** (includes `@playwright/test`):
96+
```bash
97+
cd website && npm ci
98+
```
99+
100+
2. **Install Chromium browser and OS dependencies**:
101+
```bash
102+
cd website && npx playwright install --with-deps chromium
103+
```
104+
This installs the Chromium binary plus required system libraries (libgbm, libasound, etc.).
105+
106+
3. **Verify installation**:
107+
```bash
108+
cd website && npx playwright --version
109+
```
110+
111+
### Notes
112+
113+
- Only Chromium is needed — this project does not test against Firefox or WebKit.
114+
- On the Dev Container (Ubuntu 24.04), `--with-deps` installs the OS packages automatically.
115+
- On macOS, Playwright downloads its own Chromium binary — no Homebrew needed.
116+
- Browser cache lives at `~/.cache/ms-playwright/`. Delete this to force a clean reinstall.
117+
- The website tests are at `website/tests/` and configured in `website/playwright.config.js`.
118+
- Base URL: `http://localhost:8080` (Eleventy dev server).
119+
120+
### After installing
121+
122+
Run the website tests:
123+
```bash
124+
cd website && npm test
125+
```
126+
127+
Or with UI mode:
128+
```bash
129+
cd website && npm run test:ui
130+
```

.github/workflows/ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,21 @@ jobs:
113113
done
114114
115115
- name: Test Tier 1
116-
run: ./tools/test.sh --ci --tier 1
116+
run: ./tools/test.sh --tier 1
117117

118118
- name: Test Tier 2
119-
run: ./tools/test.sh --ci --tier 2
119+
run: ./tools/test.sh --tier 2
120120

121121
- name: Test Tier 3
122-
run: ./tools/test.sh --ci --tier 3
122+
run: ./tools/test.sh --tier 3
123+
124+
- name: Upload test logs
125+
if: always()
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: test-logs
129+
path: logs/
130+
retention-days: 7
123131

124132
too-many-cooks-mcp:
125133
name: Too Many Cooks MCP Server

0 commit comments

Comments
 (0)