# Running Node-Red Tests on Gitlab CI

**URL:** <https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741>\
**Category:** General\
**Created:** [15 September 2022 10:59 UTC](https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741 "2022-09-15T10:59:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BShashwat](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@BShashwat](https://discourse.nodered.org/u/BShashwat)\
**Post date:** [15 September 2022 10:59 UTC](https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741/1 "2022-09-15T10:59:16Z")

</div>

Hi All,

I have written custom nodes and corresponding unit tests for them. They run fine locally. Now I am trying to set-up gitlab ci so that the same tests can run when any raises a Merge Request after making changes in code.

I have already setup a ci pipeline, which uses node-red image to run tests. However the problem is that as soon as the ci process downloads node-red image and completes the install phase, Node-Red automatically starts the Flows, which disrupts the command to run tests. Hence the tests never starts and the ci job hangs.

If someone can point out what I am doing wrong and what amends should I make, it will be very helpful.

Thanks & Regards,  
Shashwat

 ![nr-test-ci-issue](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91832f80e85843116d03468af6ac972abdeed76b.png)

---

<div class="post-metadata">

**Author:** ![BShashwat](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@BShashwat](https://discourse.nodered.org/u/BShashwat)\
**Post date:** [15 September 2022 13:12 UTC](https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741/2 "2022-09-15T13:12:29Z")

</div>

Any thoughts @knolleary, @TotallyInformation

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 September 2022 13:17 UTC](https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741/3 "2022-09-15T13:17:00Z")

</div>

Have you looked at [node-red-node-test-helper - npm](https://www.npmjs.com/package/node-red-node-test-helper) which allows you to write tests for nodes without having to run a full Node-RED instance?

---

<div class="post-metadata">

**Author:** ![BShashwat](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@BShashwat](https://discourse.nodered.org/u/BShashwat)\
**Post date:** [15 September 2022 18:46 UTC](https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741/4 "2022-09-15T18:46:05Z")

</div>

@knolleary ... Thanks for bringing that up. I did use that for writing node-red unit tests but when I ran tests on local I thought it worked due to local installation of node-red which I have in my system. Thanks for pointing out that with it we may not need full node-red install. I will try it out and post the results tomorrow.

---

<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:** [31 October 2022 06:20 UTC](https://discourse.nodered.org/t/running-node-red-tests-on-gitlab-ci/67741/5 "2022-10-31T06:20:34Z")

</div>

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