-
First off great job on Deno so far - kudos to the team! 🎉🎉🎉 I would like to measure code coverage of a Deno program (an HTTP server) exercised by running Postman tests against it (via the In Node.js I would achieve this by running How can I do something similiar in Deno? Maybe something like this: deno run --coverage ./main.ts &
newman ... # Run Postman tests using newman CLI
kill $SERVER_PID # Kill deno process to dump coverage numbers Or, even better, everything in one command to start server, run external tests, and end server: deno run --coverage-command 'newman ...' ./main.ts ETA: Looks like there is a workaround as detailed by @zachauten below. I have spinned up a repo demonstrating this at anishkny/deno-api-tests-coverage. ETA2: Opened #16440 for this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Coverage is generated with the
Example (this comes from some boilerplate i wrote a while ago, it may need to be updated to current deno/oak api's):
|
Beta Was this translation helpful? Give feedback.
Coverage is generated with the
--coverage
flag on thetest
command. You pretty much have the right idea, but you'll need to start the server inside a test. If you're using oak, your test could look something like:deno tests --coverage
Example (this comes from some boilerplate i wrote a while ago, it may need to be updated to current deno/oak api's):