-
-
Notifications
You must be signed in to change notification settings - Fork 364
Closed
Description
Link to bug demonstration repository
demo repo: https://github.com/Kosta-Github/ts-nyc-issue
the typescript
setup described in nyc-config-typescript has been followed
Expected Behavior
running one of the 2 provided test
scripts several times should always result in the same (correct) output/result
Observed Behavior
Sometimes the result looks like this and the generated HTML coverage report looks OK:
-------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------|----------|----------|----------|----------|-------------------|
All files | 80 | 50 | 66.67 | 80 | |
func.ts | 83.33 | 50 | 100 | 83.33 | 8 |
nested_1.ts | 100 | 100 | 100 | 100 | |
nested_2.ts | 50 | 100 | 0 | 50 | 2 |
-------------|----------|----------|----------|----------|-------------------|
=============================== Coverage summary ===============================
Statements : 80% ( 8/10 )
Branches : 50% ( 1/2 )
Functions : 66.67% ( 2/3 )
Lines : 80% ( 8/10 )
================================================================================
And sometimes the result looks like this:
-------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------|----------|----------|----------|----------|-------------------|
All files | 40 | 50 | 66.67 | 80 | |
func.ts | 50 | 50 | 100 | 100 | 5 |
nested_1.ts | 50 | 100 | 100 | 100 | |
nested_2.ts | 0 | 100 | 0 | 0 | 2 |
-------------|----------|----------|----------|----------|-------------------|
=============================== Coverage summary ===============================
Statements : 40% ( 4/10 )
Branches : 50% ( 1/2 )
Functions : 66.67% ( 2/3 )
Lines : 80% ( 4/5 )
================================================================================
And in this case the generated HTML files contain this error message:
Cannot read property 'start' of undefined
TypeError: Cannot read property 'start' of undefined
at Object.keys.forEach.stName (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-reports/lib/html/annotator.js:53:31)
at Array.forEach ()
at annotateStatements (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-reports/lib/html/annotator.js:49:33)
at Object.annotateSourceCode (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-reports/lib/html/annotator.js:239:9)
at HtmlReport.onDetail (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-reports/lib/html/index.js:265:27)
at LcovReport.(anonymous function) [as onDetail] (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-reports/lib/lcov/index.js:23:23)
at Visitor.(anonymous function) [as onDetail] (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-lib-report/lib/tree.js:34:30)
at ReportNode.Node.visit (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-lib-report/lib/tree.js:114:17)
at getChildren.forEach.child (/Users/kosta/devel/misc/ts-nyc-issue/node_modules/istanbul-lib-report/lib/tree.js:118:15)
at Array.forEach ()
Troubleshooting steps
- still occurring when I put
cache: false
in my nyc config
Environment Information
$ npx envinfo@latest --preset nyc
System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Memory: 1.20 GB / 16.00 GB
Binaries:
Node: 10.16.0 - /usr/local/opt/node@10/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.1 - /usr/local/opt/node@10/bin/npm
npmPackages:
nyc: ^14.1.1 => 14.1.1
ts-node: ^8.3.0 => 8.3.0
typescript: ^3.5.3 => 3.5.3
cbchenoweth, jednano and akoidan
Metadata
Metadata
Assignees
Labels
No labels