# How to stop writing bad nodes using the nrg cli and Vitest

**URL:** <https://discourse.nodered.org/t/how-to-stop-writing-bad-nodes-using-the-nrg-cli-and-vitest/93786>\
**Category:** Developing Nodes\
**Created:** [8 December 2024 20:02 UTC](https://discourse.nodered.org/t/how-to-stop-writing-bad-nodes-using-the-nrg-cli-and-vitest/93786 "2024-12-08T20:02:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [8 December 2024 20:02 UTC](https://discourse.nodered.org/t/how-to-stop-writing-bad-nodes-using-the-nrg-cli-and-vitest/93786/1 "2024-12-08T20:02:05Z")

</div>

I would like to share with you an example where I demonstrate how you can write tests for your nodes using Vitest

> **[GitHub - AllanOricil/nrg-template: Build Node-red nodes using ES6+ and esm module...](https://github.com/AllanOricil/nrg-template)**
>
> Build Node-red nodes using ES6+ and esm module system with the nrg cli

obs: node-red-node-test-helper is still locked to this [commit](https://github.com/node-red/node-red-node-test-helper/commit/949edd23270b26b261f0f9b6596b548d5f80a6d4) because my changes to enable vitest were not released yet

obs: unit tests are still being written

obs: i'm also trying to enable e2e testing using playwright with multiple browsers. You can use `npm run test:e2e` but it wont test anything useful yet. At least the configuration is fine.

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [10 December 2024 22:32 UTC](https://discourse.nodered.org/t/how-to-stop-writing-bad-nodes-using-the-nrg-cli-and-vitest/93786/2 "2024-12-10T22:32:31Z")

</div>

You can ask questions. Dont be shy

---

<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:** [8 February 2025 22:33 UTC](https://discourse.nodered.org/t/how-to-stop-writing-bad-nodes-using-the-nrg-cli-and-vitest/93786/3 "2025-02-08T22:33:31Z")

</div>

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