Skip to content

Coverage numbers depend on leftover fixtures/*/results from a previous run #261

Description

@unional

Found while doing #259 / #260. Not caused by that change — it reproduces on main unmodified.

This suite reports different coverage depending on whether fixtures/*/results already exists:

tree Statements Branches Functions Lines
cold (after pnpm clean) 96.81 93.42 93.1 96.7
warm (a second pnpm coverage) 97.17 94.73 94.25 96.7

The delta is entirely in src/match.ts. createMatchFunction snapshots the result directory up front, and removeUnchangedFiles only runs when there are prior result files to compare against — so on a cold tree that path and its branches are never taken.

Two consequences:

  1. vitest.config.ts carries a comment attributing these two number sets to "platform-conditional paths [that] are not taken on the ubuntu runner". That explanation is wrong. CI reports the lower pair because CI is always a cold checkout, not because of the platform. The comment should be corrected so the next person tuning the thresholds is not misled.
  2. The thresholds are effectively pinned to the cold numbers, which is the right choice, but it is accidental rather than stated.

Worth deciding whether removeUnchangedFiles should have a test that exercises it deterministically, which would collapse the two sets into one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions