poku
Version:
🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.
46 lines (45 loc) • 2.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.todo = todo;
exports.skip = skip;
exports.onlyDescribe = onlyDescribe;
exports.onlyIt = onlyIt;
const node_process_1 = require("process");
const poku_js_1 = require("../../configs/poku.js");
const callback_js_1 = require("../../parsers/callback.js");
const get_arg_js_1 = require("../../parsers/get-arg.js");
const format_js_1 = require("../../services/format.js");
const write_js_1 = require("../../services/write.js");
const describe_js_1 = require("./describe.js");
const core_js_1 = require("./it/core.js");
async function todo(messageOrCb, _cb) {
const message = typeof messageOrCb === 'string' ? messageOrCb : 'Planning';
poku_js_1.GLOBAL.reporter.onTodoModifier({ message });
}
async function skip(messageOrCb, _cb) {
const message = typeof messageOrCb === 'string' ? messageOrCb : 'Skipping';
poku_js_1.GLOBAL.reporter.onSkipModifier({ message });
}
async function onlyDescribe(messageOrCb, cb) {
if (!get_arg_js_1.hasOnly) {
(0, write_js_1.log)((0, format_js_1.format)("Can't run `describe.only` tests without `--only` flag").fail());
(0, node_process_1.exit)(1);
}
const noItOnly = (0, callback_js_1.CheckNoOnly)(typeof messageOrCb === 'function' ? messageOrCb : cb);
if (noItOnly)
poku_js_1.GLOBAL.runAsOnly = true;
if (typeof messageOrCb === 'string' && cb)
return (0, describe_js_1.describeBase)(messageOrCb, cb);
if (typeof messageOrCb === 'function')
return (0, describe_js_1.describeBase)(messageOrCb);
}
async function onlyIt(messageOrCb, cb) {
if (!get_arg_js_1.hasOnly) {
(0, write_js_1.log)((0, format_js_1.format)("Can't run `it.only` and `test.only` tests without `--only` flag").fail());
(0, node_process_1.exit)(1);
}
if (typeof messageOrCb === 'string' && cb)
return (0, core_js_1.itBase)(messageOrCb, cb);
if (typeof messageOrCb === 'function')
return (0, core_js_1.itBase)(messageOrCb);
}