Running Node-Red Tests on Gitlab CI

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,

Any thoughts @knolleary, @TotallyInformation

Have you looked at node-red-node-test-helper - npm which allows you to write tests for nodes without having to run a full Node-RED instance?


@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.

1 Like