Skip to content

includeAllFiles can add a duplicate placeholder on Windows when path casing differs #1018

Open

Description

@jennifer-shehane

While working on #360, a review turned up a related edge case in includeAllFiles (lib/task-utils.ts) that seemed worth tracking on its own rather than folding into that fix.

What happens

To decide whether a globbed file is already covered, includeAllFiles converts each covered entry's path to forward slashes and compares it to the tinyglobby path with an exact, case-sensitive string match. Windows paths aren't case-sensitive, though. So if the two sides disagree only on casing, for example the drive letter (c:\proj\src\a.js from the instrumenter vs C:/proj/src/a.js from the glob), the file isn't recognized as covered and gets a second, empty placeholder entry.

Why it matters

The same file then shows up twice in the report, once with real coverage and once at 0%. That drags the totals down and can make --check-coverage fail.

Status

I haven't reproduced this in a real run yet. It comes from reading the code, so the first step is confirming which setups actually produce mismatched casing (Git Bash vs cmd.exe working directories are a likely suspect). If it's real, a fix could compare a case-folded form of the path on Windows only, leaving POSIX matching untouched.

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