Skip to content

Measure runtime code coverage caused by running Postman/newman tests #16292

Answered by zachauten
anishkny asked this question in Q&A
Discussion options

You must be logged in to vote

Coverage is generated with the --coverage flag on the test 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:

  1. import server to test
  2. create an abort controller and start the server with it.
  3. shell our to run the tests.
  4. use the abort controller to kill the server.
  5. run the server with 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):

import { server } from "./server.ts";

Deno.test("test server", async t => {

  const application = app();
  const controller = new AbortController();
  const { signal } …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@anishkny
Comment options

@gm112
Comment options

@anishkny
Comment options

Answer selected by anishkny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #16291 on October 15, 2022 12:45.