bcoe / bcoe/c8

--all will create duplicate report entries on win32

Open
#191 4 comments 0 reactions 1 assignee Claimed by @j03m View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

* **Version**: 7.0.0
* **Platform**: win32

This is a bit of a "canned" issue because it assumes that https://github.com/bcoe/c8/issues/183 is fixed upstream. But when testing out my fix https://github.com/istanbuljs/test-exclude/pull/44 I noticed there is an additional path casing issue in `c8` related to the implementation of `--all`.

On windows, using local files it is possible for v8 to generate file names like: `d:\path\to\my\file.js`
note the lower case drive letter.

But later when find `--all` files the node api post call to `resolve` will return the same string paths with a upper case drive letter. This is what originally caused https://github.com/bcoe/c8/issues/183.

However, once #183 is fixed and `test-exclude`'s `shouldInstrument` returns true for case mismatches, this additional mismatch in `c8`'s `fileIndex` Set which we use to track if a file has been seen causes duplicates in the final report:

For example the output might be as follows:
```
file1.js | 0 | 0 | 0 | 0 | 1-36
file1.js | 100 | 100 | 100 | 100 |
file2.js | 0 | 0 | 0 | 0 | 1-106
file2.js | 90.57 |
```

My current thoughts were to replace `fileIndex` the `Set` with an overridden Set that would `toLowerCase` keys when `win32` is detected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.