Open mrubli opened 4 years ago
Yes, the error gets swallowed by the internals.
The workaround is to wrap tests code in a try/catch so you can pass the failure to the done
function:
n2.on("input", function (msg) {
try {
msg.should.have.property('payload', 'uPPercase');
done();
} catch(err) {
done(err);
}
});
@knolleary Thanks a lot for the quick response, that worked great! I could have sworn having tried something like that at one point ...
I've created PR #46 that updates both the lower-case example and the documentation to include this trick.
I am unable to get failed unit test assertions to output the actual error condition. Instead, what happens is that the test times out with no hint of the actual error.
This is easily reproducible with the included
lower-case_spec.js
test:Actual behavior
As long as no tests fail everything is fine:
Let's change the test a bit to make an assertion fail:
Note how the test times out without a trace of the assertion error:
Expected behavior
I would expect the test to fail something like this:
Given how the test helper works I could imagine that these exceptions get swallowed by Node-RED itself, so maybe this is a design limitation. But if there's a way to workaround it or even a way to fix the problem that would be great. I haven't been able to figure it out.