node-red/node-red-node-test-helper

In Node-RED 1.x using helper.log().args doesn't show Errors

natcl opened this issue · 4 comments

natcl commented

My node throws an error and with Node-RED 0.20.x I used to be able to get that error in helper.log().args. In Node-RED 1.x the error doesn't seem to be in the array anymore.
I created a small repo based on the lower-case example to demonstrate this issue, to test you can do the following:

# Works:
git clone git@github.com:natcl/lower-case-fail.git
cd lower-case-fail
npm install
npm test

# Fails:
git checkout origin/nr1fail
npm install
npm test
natcl commented

Update: seems like wrapping the call containing helper.log().args into a setTimeout solves the issue.

how about a setImmediate ? (ie just just push it to next loop ?)

natcl commented

I'll test that, (the core nodes seem to use setTimeout with different timing values though, I checked the JSON node test specifically)

natcl commented

Just tested and setImmediate works fine in my case too. Thanks !