Commit 41bd751
authored
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- .claude/skills
- setup-claude
- setup-playwright
- setup
- .github/workflows
- examples
- markdown_editor
- reflux_demo/web_counter
- packages
- dart_node_coverage/lib/src
- dart_node_express
- dart_node_mcp
- test
- dart_node_react
- dart_node_vsix
- scripts
- test/suite
- dart_node_ws
- tools
16 files changed
+2993
-216
lines changedThis file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
| |||
0 commit comments