Repository navigation
Commit f2e74d2
authored
test(coverage): fix what the deletion pins claimed (#3501)
* test(coverage): fix what the deletion pins claimed
Two review threads survived #3486 and #3492 because both were merged while the
checks were still queued.
The second deletion case was named for a function whose own lines did not
change, and its own fixture deletes a line inside that function. Renamed to the
scenario it covers: additions below the span, alongside a removal inside it.
The third case pinned its fixture rather than any scoping rule, since a function
absent from the map is unscored in either scope. Measured that first: a stale
map which still records the deleted function yields nothing from `--all`
either, so no scoping keeps it uncharged — the removal takes the score with it.
The test now asserts that in both scopes and says which of the two mechanisms it
is evidence for.
CONTRIBUTING said removing code retires debt. It does not always: dropping lines
that used to be covered lowers the coverage side of the ratio and can raise the
score, and that debt lands in the `--all` backlog rather than the PR. The
sentence now says deletions are uncharged, which is the accurate claim, and
names where the debt it can create goes.
Part of #3414.
* test(coverage): score the deleted-function pin against the map it claims
Both review points on the previous commit were right.
The third case's `--all` assertion proved nothing about a stale map, because its
fixture recorded no functions at all — there was no deleted-function score for
`--all` to omit. It now keeps the `score` record at CRAP 42 while the source
loses the function, which is the shape a forgotten `pnpm test:coverage` really
leaves behind, and asserts `--all` omits it anyway: scoring walks the source, so
neither scope reports a function that is no longer there. Measured through
run() before being written.
CONTRIBUTING said a deletion's raised score reaches `--all` rather than the PR,
which holds only when no added line lands inside that function — a charged
function is scored as it stands after the deletions, so the rise blocks with it.
Said conditionally now. The rewrap also brought two over-long lines this
paragraph had inherited back under the house width.1 parent ecf597b commit f2e74d2
2 files changed
Lines changed: 26 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
317 | 316 | | |
318 | 317 | | |
319 | 318 | | |
| |||
329 | 328 | | |
330 | 329 | | |
331 | 330 | | |
332 | | - | |
333 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
334 | 338 | | |
335 | | - | |
| 339 | + | |
336 | 340 | | |
337 | 341 | | |
338 | 342 | | |
339 | 343 | | |
340 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
341 | 348 | | |
342 | 349 | | |
343 | 350 | | |
| |||
0 commit comments