This project pulls out the node helper module from the Node-RED core so that it can used for node contributors.
For examples on how to use this helper, see the Node-RED core node test code and some node .js files supplied in the
To add to your node project test dependencies:
npm install node-red-test-helper --save-dev
Inside your node test code:
var helper = ;
npm run test
This is an example test for testing the lower-case node in the Node-RED documentation.
var should = ;var helper = ;var lowerNode = ;;
Load the test node, flows and credentials, creates a 'helper' node.
Return promise to stop all flows, clean up test runtime and log spy.
Get the node from the runtime.
Calls RED.flows.stopFlows() to stop all flows.
Create http (supertest) request to the editor/admin url.
Start a Node-RED test server;
done() when complete.
Stop server. Generally called after unload() complete
Return the URL of the helper server.
Return a spy on the logs to look for events from the node under test. For example:
var logEvents = helperargs