If the tests fail with a severe error , like requiring a non-existing script, or by a syntax error in a script, the error is not printed correctly. It is an object and after applying toString to it, even the cat cannot improve the useless output ;-)
For example, if JSON.stringify were applied to it to get the full object printed, it would look like this:
HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR
{
"message": "Uncaught Error: 'expect' was used when there was no current spec,...",
"str": "Uncaught Error: 'expect' was used when there was no current spec, ..."
}
As long as the object structure is known, if object.message is defined, the message can be printed right away:
HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR
Error: 'expect' was used when there was no current spec,...
If the tests fail with a severe error , like requiring a non-existing script, or by a syntax error in a script, the error is not printed correctly. It is an object and after applying
toString
to it, even the cat cannot improve the useless output ;-)For example, if
JSON.stringify
were applied to it to get the full object printed, it would look like this:As long as the object structure is known, if
object.message
is defined, the message can be printed right away: