You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--experimental-test-coverage throws TypeError if directory is named file #61080
In printCoverageBodyTree, a directory named file seems to conflict with internal variable named file. Causing it to treat the directory as a file.
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
Generate test coverage normally.
What do you see instead?
TypeError: String.prototype.split called on null or undefined
at split (<anonymous>)
at printCoverageBodyTree (node:internal/test_runner/utils:536:44)
at printCoverageBodyTree (node:internal/test_runner/utils:565:9)
at getCoverageReport (node:internal/test_runner/utils:585:3)
at #handleEvent (node:internal/test_runner/reporter/spec:102:16)
at SpecReporter._transform (node:internal/test_runner/reporter/spec:112:37)
at Transform._write (node:internal/streams/transform:171:8)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at Writable.write (node:internal/streams/writable:508:10)
Emitted 'error' event on Readable instance at:
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
changed the title [-]--experimental-test-coverage throws TypeError if folder is named file[/-][+]--experimental-test-coverage throws TypeError if directory is named file[/+]on Dec 16, 2025
Activity
[-]--experimental-test-coverage throws TypeError if folder is named file[/-][+]--experimental-test-coverage throws TypeError if directory is named file[/+]Han5991 commentedon Dec 17, 2025
I think it only works on Windows
joshuaavalon commentedon Dec 19, 2025
@Han5991 I pretty sure it works on Linux because I first found it out on GitHub action.
I created a repository. https://github.com/joshuaavalon/node-coverage
https://github.com/joshuaavalon/node-coverage/actions/runs/20357487020/job/58495852805

Han5991 commentedon Dec 19, 2025
It works on Mac too!
test_runner: fix coverage report when a directory is named file
test_runner: fix coverage report when a directory is named file
test_runner: fix coverage report when a directory is named file
test_runner: fix coverage report when a directory is named file
test_runner: fix coverage report when a directory is named file