poku
Version:
🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.
31 lines (30 loc) • 1.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.exit = void 0;
const node_assert_1 = require("assert");
const node_process_1 = __importDefault(require("process"));
const poku_js_1 = require("../../configs/poku.js");
const exit = (code, quiet) => {
const isPoku = poku_js_1.results.passed > 0 || poku_js_1.results.failed > 0;
if (!quiet && isPoku)
poku_js_1.GLOBAL.reporter.onExit({
code,
timespan: poku_js_1.timespan,
results: poku_js_1.results,
});
node_process_1.default.exitCode = code === 0 ? 0 : 1;
};
exports.exit = exit;
node_process_1.default.on('unhandledRejection', (err) => {
if (!(err instanceof node_assert_1.AssertionError))
console.error('unhandledRejection', err);
node_process_1.default.exitCode = 1;
});
node_process_1.default.on('uncaughtException', (err) => {
if (!(err instanceof node_assert_1.AssertionError))
console.error('uncaughtException', err);
node_process_1.default.exitCode = 1;
});