Errors not being displayed.
I'm using this as described in the README but errors are not being displayed. My code:
suite.on('cycle', function(event) {
if (event.target.error) {
console.log(event.target.error)
}
beautifyBenchmark.add(event.target)
})
suite.on('complete', function() {
beautifyBenchmark.log()
})
The console.log is printing out the errors, but beautify-benchmark never does.
Okay, so it looks like the problem is that if a runtime error happens it's an instance of Error, which has non-enumerable properties. i.e. Using Object.keys() returns an empty array whereas Object.getOwnPropertyNames() returns an actually useful list.
Arguably though this should just be rendering the stack trace (which includes the error message) rather than displaying a comma-separated list of all the attributes.
Workaround for now:
suite.on('cycle', function(event) {
if (event.target.error) {
event.target.error = {
stack: event.target.error.stack,
}
}
beautifyBenchmark.add(event.target)
})