|
1 | | -# Coverage — msgpack 3.0.0 |
| 1 | +# Coverage — msgpack 3.1.0 |
2 | 2 |
|
3 | 3 | `npm run coverage` runs both halves and fails the build under 95%. |
4 | 4 |
|
|
8 | 8 | | `lib/` + `bin/` (c8) | branches | **100%** | ≥ 95% | |
9 | 9 | | `lib/` + `bin/` (c8) | functions | **100%** | ≥ 95% | |
10 | 10 | | `lib/` + `bin/` (c8) | lines | **100%** | ≥ 95% | |
11 | | -| `src/msgpack.cc` (gcovr) | lines | **95.9%** (473/493) | ≥ 95% | |
12 | | -| `src/msgpack.cc` (gcovr) | branches | **99.5%** (400/402) | ≥ 95% | |
13 | | -| `src/msgpack.cc` (gcovr) | functions | 100% (36/36) | — | |
| 11 | +| `src/` (gcovr) | lines | **95.2%** (902/947) | ≥ 95% | |
| 12 | +| `src/` (gcovr) | branches | **95.4%** (836/876) | ≥ 95% | |
| 13 | +| `src/` (gcovr) | functions | 100% (59/59) | — | |
14 | 14 |
|
15 | 15 | `deps/` is excluded from the native report; the vendored msgpack-c is not our |
16 | 16 | code. `build/` is rebuilt without instrumentation at the end of |
@@ -56,12 +56,12 @@ Every one is an error arm that cannot be entered from JS without stubbing |
56 | 56 | | 735 | `throw` after `msgpack_pack_array` in `Pack` | Allocation failure only. | |
57 | 57 | | 809–813, 815 | `MSGPACK_UNPACK_CONTINUE` / parse-error tail of `Unpack` | `ScanOne` walks the same grammar first with limits at or below the vendored library's own (511 vs 512 nested containers, the same 1 000 000 element cap), so once it returns `kScanOk`, `msgpack_unpack_next` can only succeed. The arms stay so a future divergence fails closed instead of reading `result.data` uninitialised. | |
58 | 58 |
|
59 | | -## Remaining uncovered native branches (2 of 402) |
| 59 | +## Remaining uncovered native branches in `msgpack.cc` (2) |
60 | 60 |
|
61 | 61 | | Line | Code | Why | |
62 | 62 | | --- | --- | --- | |
63 | | -| 148 | `switch (b)` in `ScanOne` | The `default:` edge — see lines 307–308 above. It cannot be excluded on its own without also dropping the 30 covered case edges on the same line, so it is left in and counted against us. | |
64 | | -| 575 | `switch (mo->type)` in `MsgpackToJs` | Same, for the `default:` edge covering the complete `msgpack_object_type` enum. | |
| 63 | +| 154 | `switch (b)` in `ScanOne` | The `default:` edge — see lines 307–308 above. It cannot be excluded on its own without also dropping the 30 covered case edges on the same line, so it is left in and counted against us. | |
| 64 | +| 611 | `switch (mo->type)` in `MsgpackToJs` | Same, for the `default:` edge covering the complete `msgpack_object_type` enum. | |
65 | 65 |
|
66 | 66 | ## About the native branch number |
67 | 67 |
|
@@ -139,6 +139,13 @@ gcovr --root . --filter src/ --exclude deps/ --no-markers --txt-metric branch -- |
139 | 139 | failure modes and mark cleanup; and a worker that nests 600 packs deep to |
140 | 140 | saturate the thread-local sbuffer pool and reach the "pool is full, free it" |
141 | 141 | arm of `~PackBuffer`. |
| 142 | +- `test/pack-hints.test.js` — `pack(value, { type, family, interpret })` wire |
| 143 | + types, last-arg options detection (host objects, Proxies, ownKeys throws), |
| 144 | + and the reachable miss paths in `src/pack_hints.inc`. Unreachable arms |
| 145 | + (empty `info[1]`, `kTypeNone` / `kFamilyNone` defaults, hinted |
| 146 | + `kMaxPackDepth`) are marked `GCOVR_EXCL_*`, not deleted. Native overall |
| 147 | + stays above the 95% gate (`pack_hints.inc` itself is 91% branches because |
| 148 | + switch `default:` edges sit on the same line as covered cases). |
142 | 149 | - `test/cli.test.js` (12 tests) — the exit-1 paths of both CLIs: invalid JSON, |
143 | 150 | empty stdin, a pack rejection reachable from real JSON, an unparseable byte, |
144 | 151 | an oversized header, incomplete input both alone and after a good frame, and |
|
0 commit comments