# How to Aggregate and View Code Coverage for All Custom Node Modules in a Single Execution

**URL:** <https://discourse.nodered.org/t/how-to-aggregate-and-view-code-coverage-for-all-custom-node-modules-in-a-single-execution/94608>\
**Category:** General\
**Created:** [14 January 2025 09:48 UTC](https://discourse.nodered.org/t/how-to-aggregate-and-view-code-coverage-for-all-custom-node-modules-in-a-single-execution/94608 "2025-01-14T09:48:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DhamodharanGopal](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dhamodharangopal/32/95512_2.png) [@DhamodharanGopal](https://discourse.nodered.org/u/DhamodharanGopal)\
**Post date:** [14 January 2025 09:48 UTC](https://discourse.nodered.org/t/how-to-aggregate-and-view-code-coverage-for-all-custom-node-modules-in-a-single-execution/94608/1 "2025-01-14T09:48:03Z")

</div>

I’m working with multiple custom Node-RED modules, and I want to execute and view the test case results for all my custom modules while generating a consolidated code coverage report in a single execution.

**Folder Structure and Context**  
Here is an example of my folder structure for one of the custom modules:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a5325e415a8e107f3ede44295ac6bb7ee9d46c8a.png)  
Below attached the package.json for reference

```auto
{
  "name": "node-red-contrib-create-jwt-token",
  "version": "1.0.0",
  "description": "",
  "main": "create-jwt-token.js",
  "keywords": [
    "node-red"
  ],
  "node-red": {
    "nodes": {
      "create-jwt-token": "create-jwt-token.js"
    }
  }, 
  "nyc": {
  "reporter": ["text", "html"],
  "report-dir": "./coverage"
},
   "scripts": {
    "test": "nyc mocha test/create-jwt-token_spec.js"
  },

  
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "chai": "^5.1.2",
    "mocha": "^11.0.1",
    "node-red": "^4.0.7",
    "node-red-node-test-helper": "^0.3.4",
    "sinon": "^19.0.2",
    "sinon-chai": "^4.0.0"
  }
}

```

**Goal**  
**I want to:**

- Run tests for all custom modules at once.
- Generate a unified code coverage report for all these modules.
- Export or view the test results for each custom module in one go.

**Challenges**

- Currently, I can run tests and view coverage for individual modules using nyc mocha, but I’m unsure how to configure this for multiple custom modules collectively in a way that provides a combined coverage report.

**Questions**

- What’s the best approach to aggregate tests and generate a combined coverage report for multiple Node-RED custom modules?
- Are there specific tools or configurations in nyc or other test frameworks that can facilitate this?
- Any examples or recommendations for managing consolidated test execution and reporting in a Node-RED custom module environment?
- Looking forward to your insights!

Thank you in advance for your guidance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 April 2025 09:48 UTC](https://discourse.nodered.org/t/how-to-aggregate-and-view-code-coverage-for-all-custom-node-modules-in-a-single-execution/94608/2 "2025-04-14T09:48:50Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
