istanbuljs / nyc

the Istanbul command line interface

Home Page:https://istanbul.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nyc coverage empty when instrumenting ng serve

testgitdl opened this issue · comments

Expected Behavior

I want to obtain coverage information for an Angular CLI project

Observed Behavior

The files in nyc_output are either empty or contain no information

Troubleshooting steps

I am running nyc --instrument npm run start to serve my app where start is: "start": "ng serve -c dev"
An nyc_output folder is created but there is no coverage info. What I also noticed is that in the chrome console if I get window.coverage as undefined.
Under processInfo:
{"parent":"12872e46-f0db-433b-9e85-e39c8d533aec","pid":13468,"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\_AutomationProjects\\WDP_DUIF2\\WDP_DUIF\\DUIF\\node_modules\\@angular\\cli\\bin\\ng.js","serve","-c","dev"],"execArgv":[],"cwd":"C:\\_AutomationProjects\\WDP_DUIF2\\WDP_DUIF\\DUIF","time":1672820829284,"ppid":9584,"coverageFilename":"C:\\_AutomationProjects\\WDP_DUIF2\\WDP_DUIF\\DUIF\\.nyc_output\\0a466ad8-872a-4287-ba6c-1fb9460561ad.json","externalId":"","uuid":"0a466ad8-872a-4287-ba6c-1fb9460561ad","files":[]}
And content of 0a466ad8-872a-4287-ba6c-1fb9460561ad.json is {}