UNPKG

nightwatch-html-reporter

Version:

Generates an HTML view of the Nightwatch.js test reports by either parsing the XML files generated by Nightwatch or by using the Nightwatch reporter options.

29 lines (23 loc) 529 B
var util = require('util'); var levels = ['log', 'info', 'warn', 'error']; var ret = { level: 1, setLevel: function(level) { this.level = level; }, obj: function(object, method) { this[method](util.inspect(object, false, null)); } }; levels.forEach(function(fn, index) { ret[fn] = function() { if (typeof console === 'undefined') return; if (index >= ret.level) { if (!console[fn]) fn = 'log'; console[fn].apply(console, arguments); } }; }); module.exports = ret;