poku
Version:
🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.
42 lines (41 loc) • 1.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.compact = void 0;
const reporter_js_1 = require("../../builders/reporter.js");
const time_js_1 = require("../../parsers/time.js");
const format_js_1 = require("../format.js");
const write_js_1 = require("../write.js");
const poku_js_1 = require("./poku.js");
exports.compact = (() => {
let countFails = 0;
return (0, reporter_js_1.createReporter)({
onRunStart() { },
onFileStart() { },
onDescribeAsTitle() { },
onDescribeStart() { },
onDescribeEnd() { },
onItStart() { },
onItEnd() { },
onAssertionSuccess() { },
onSkipFile() { },
onSkipModifier() { },
onTodoModifier() { },
onFileResult({ status, path, output }) {
(0, write_js_1.log)(`${status ? (0, format_js_1.format)(' PASS ').bg('brightGreen') : (0, format_js_1.format)(' FAIL ').bg('brightRed')} ${path.relative}`);
if (!status) {
countFails++;
poku_js_1.errors.push({
file: path.relative,
output,
});
}
},
onExit({ timespan, results }) {
if (countFails > 0)
(0, write_js_1.hr)();
(0, write_js_1.log)(`${(0, format_js_1.format)(String(results.passed)).bold().dim()} ${(0, format_js_1.format)('test file(s) passed').dim()}`);
(0, write_js_1.log)(`${(0, format_js_1.format)(String(results.failed)).bold().dim()} ${(0, format_js_1.format)('test file(s) failed').dim()}`);
(0, write_js_1.log)(`${(0, format_js_1.format)(`Finished in ±${(0, time_js_1.parseTimeToSecs)(timespan.duration)} seconds`).dim()}`);
},
});
})();