Javascript Step Logging

7 months ago by Geoff Cooney

With the latest release, mabl now supports capturing logs during Javascript steps. Any calls to console.log, console.warn, or console.error inside the Javascript step will show up as part of your mabl log output as well as writing to the browser console. If you have existing steps with console calls, mabl will automatically start picking up that log output without any changes required.

We've also expanded on the callback to support passing back the error string as an additional argument. This makes throw Error('failed') equivalent to callback(null, 'failed')

Note that for this release, console.log, console.warn, and console.error all result in info level log lines in the mabl log lines. Look for this to be differentiated in the future so we recommend you use the call that accurately reflects the severity of the log statement.

A Javascript step that looks like this:

Would print out:


-mabl will only capture the first 10 log lines per Javascript step in the output logs
-mabl only captures the first argument to the console logging functions and will log the string verbatim. We do not currently support interpolated strings.
-mabl cannot capture logs in cases where the Javascript step times out. If you are trying to debug a step that keeps timing out you can temporarily moving the return sooner to get intermediate debugging feedback.