@stryker-mutator/tap-runner
Version:
A plugin to use the TAP (test anything protocol) test runner in Stryker, the JavaScript mutation testing framework
24 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const fs_1 = tslib_1.__importDefault(require("fs"));
const env_cjs_1 = require("./env.cjs");
const strykerGlobalNamespace = process.env[env_cjs_1.strykerNamespace] ?? '__stryker__';
const dryRun = process.env[env_cjs_1.strykerDryRun] === 'true';
const hitLimit = process.env[env_cjs_1.strykerHitLimit] ? +process.env[env_cjs_1.strykerHitLimit] : undefined;
global[strykerGlobalNamespace] = {};
if (hitLimit) {
global[strykerGlobalNamespace].hitLimit = hitLimit;
global[strykerGlobalNamespace].hitCount = 0;
}
process.on('exit', finalCleanup);
['SIGABRT', 'SIGINT', 'SIGHUP', 'SIGTERM'].forEach((signal) => process.on(signal, (_, signalNumber) => {
process.exit(128 + signalNumber);
}));
function finalCleanup() {
if (!dryRun) {
delete global[strykerGlobalNamespace].mutantCoverage;
}
fs_1.default.writeFileSync((0, env_cjs_1.tempTapOutputFileName)(process.pid), JSON.stringify(global[strykerGlobalNamespace]));
}
//# sourceMappingURL=hook.cjs.map