#2712·subql

How do I collect code coverage from subql-node test ?

Author: atodorovCreated Mar 7, 2025Updated Mar 7, 2025

I am trying to collect code coverage metrics from subql-node test in my project.

So far I've experimented with nyc but the produced report is shown as 0% coverage. Here's my config:

  1. Follow the instructions at https://www.npmjs.com/package/@istanbuljs/nyc-config-typescript

  2. .nycrc:

{
    "extends": "@istanbuljs/nyc-config-typescript",
    "all": true
}
  1. Add "sourceMap": true in tsconfig.json

My command line is nyc --require ts-node/register --require source-map-support/register subql-node test.