e2ed
Version:
E2E testing framework over Playwright
31 lines (30 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.exitFromTestsSubprocess = void 0;
const configurator_1 = require("../../configurator");
const environment_1 = require("../environment");
const generalLog_1 = require("../generalLog");
let isExitAlreadyCalled = false;
/**
* Exit from current tests subprocess.
* @internal
*/
const exitFromTestsSubprocess = async ({ hasError, reason }) => {
if (isExitAlreadyCalled || configurator_1.isLocalRun) {
return;
}
isExitAlreadyCalled = true;
(0, generalLog_1.generalLog)(`Exit from tests subprocess${hasError ? ' with error' : ''} for the reason: ${reason}`);
try {
await (0, generalLog_1.writeLogsToFile)();
}
catch (error) {
const runLabel = (0, environment_1.getRunLabel)();
(0, generalLog_1.generalLog)(`Caught an error when writing logs to logs file in retry with label "${runLabel}"`, {
error,
});
}
const exitCode = hasError ? 1 : 0;
process.exit(exitCode);
};
exports.exitFromTestsSubprocess = exitFromTestsSubprocess;