How to generate report for active node server?
See original GitHub issue- Version: 16.18.0
- Platform: Ubuntu 20.04 x86_64 GNU/Linux
Hi, I want to use c8 for checking code coverage for my typescript based node server. My use case is:
- Frontend will have test scripts which will try to cover maximum APIs.
- We want to start server in usual way along with c8, with command similar to
c8 node --loader ts-node/esm app.ts
. - Now when the frontend tests gets completed, I want to somehow generate the code coverage reports for the server.
Issue:
Right now from what I have read till now, I need to gracefully exit the server using process.exit(0)
post which c8 generates the report. But for doing this, it would require to exposing an API which calls process.exit(). This temporary solution works but it doesn’t seem to be ideal way. I tried using kill {PID}
commands and usual CTRL + C
to end the server but none of them works. Am I missing something or is there any better way to generate report?
Issue Analytics
- State:
- Created 9 months ago
- Comments:5
Top Results From Across the Web
GENERATE A REPORT WHICH TELLS YOU NODE AND ...
Report Lab GENERATE A REPORT WHICH TELLS YOU NODE AND ALERT(NAME AND MESSAGE) CONFIGURED FOR ALL NODE : NOTE REPORT SHOULD NOT INCLUDE...
Read more >Using Node.js for Reporting - SparkPost
In this post I'll demonstrate how we use SparkPost to build an email report. We're going to build what we refer to as...
Read more >JavaScript Report Designer | ActiveReportsJS - YouTube
Build scalable reporting applications with ActiveReportsJS. The ActiveReportsJS Designer is a desktop app for creating and modifying reports ...
Read more >Debugging NodeJS in Production with Diagnostic Reports
Diagnostic Reports are a recent addition to Node. js core. This feature enables insight into Node. js processes running in production—without ...
Read more >report-toolkit for Node.js – report-toolkit Quick Start
Install · Generate a Diagnostic Report · Redact Secrets From a Report · Compare Two Reports · Detect Problems within a Report ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @olivierodo , For my node server, i created an api as
Run server as
c8 node app.js
. Then start testing from frontend (my use case). Call this/coverage
api at end of testing directly from frontend. In server terminal, runc8 report
.After calling this API, the v8 code coverage JSON is generated at directories mentioned in c8 config.
Let me know if you need more details.
@cion-yatindra There is multiple issue related to the same topic, actually the issue is not coming from c8, its coming from how nodejs manage the flag NODE_V8_COVERAGE , you can refer to this issue: https://github.com/nodejs/node/issues/29896
Now related to your use case what i would suggest is to use c8 programmatically and build a test launcher that will spin up your server through a child process. Then when your tests are finished you can send a kill signal to your app running in the child process that would then close your server gracefully. I’ll be happy to share in detail how to do if you want to 😁.