reporter.js 412 B

12345678910111213141516171819
  1. "use strict";
  2. /**
  3. * Reporter for benchmarks.
  4. * @method reporter
  5. * @namespace benchmarksman
  6. * @param {Benchmark} bench The `benchmark.js` test
  7. */
  8. module.exports = function reporter(bench){
  9. var ctx = this;
  10. return bench
  11. .on("error", function(){
  12. if (ctx.file) console.error("ERROR in file: " + ctx.file);
  13. throw bench.error;
  14. })
  15. .on("complete", function() {
  16. console.log(String(this));
  17. });
  18. };