Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k
stars
786
forks
source link
Coverage not being collected from file called "payload.ts" #951
All of my test suites are running correctly, but one file in particular isn't collecting coverage.
It seems mad, but I feel like it's related to the filename (?!), payload.ts.
I have three files in my ./src directory:
payload.ts
utility.ts
index.ts
However, when I run Jest I get the following output:
$ jest --no-cache
PASS tests/payload.test.ts
PASS tests/utility.test.ts
------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------|---------|----------|---------|---------|-------------------
All files | 73.68 | 70.37 | 57.14 | 72.97 |
index.ts | 0 | 100 | 100 | 0 | 7-8
utility.ts | 77.77 | 70.37 | 57.14 | 77.14 | 8-9,53-68
------------|---------|----------|---------|---------|-------------------
Test Suites: 2 passed, 2 total
Tests: 16 passed, 16 total
Snapshots: 0 total
Time: 8.816 s
Ran all test suites.
✨ Done in 10.42s.
I've tried removing / re-creating the payload.ts file, thinking it might be filesystem related, but no luck. I've also tried the --no-cache flag that I've seen mentioned elsewhere, but again, no luck.
If I rename the file to something like payload_s.ts, it works as expected, generating coverage.
I'll try and put a re-production together sometime soon, but wanted to post this before I forgot / just renamed the file and called it a day.
This is a very strange one, and I've exhausted known possibilites, at least that I can think of.
I have the following coverage config for jest:
All of my test suites are running correctly, but one file in particular isn't collecting coverage.
It seems mad, but I feel like it's related to the filename (?!),
payload.ts
.I have three files in my
./src
directory:However, when I run Jest I get the following output:
I've tried removing / re-creating the
payload.ts
file, thinking it might be filesystem related, but no luck. I've also tried the--no-cache
flag that I've seen mentioned elsewhere, but again, no luck.If I rename the file to something like
payload_s.ts
, it works as expected, generating coverage.I'll try and put a re-production together sometime soon, but wanted to post this before I forgot / just renamed the file and called it a day.
Thanks