gauge-ts
Version:
Typescript runner for Gauge
32 lines (31 loc) • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionStartingProcessor = void 0;
const node_inspector_1 = require("node:inspector");
const HookRegistry_1 = require("../models/HookRegistry");
const HookType_1 = require("../models/HookType");
const HookExecutionProcessor_1 = require("./HookExecutionProcessor");
const ATTACH_DEBUGGER_EVENT = "Runner Ready for Debugging";
class ExecutionStartingProcessor extends HookExecutionProcessor_1.HookExecutionProcessor {
hookType = HookType_1.HookType.BeforeSuite;
static sleepFor(ms) {
const now = new Date().getTime();
while (new Date().getTime() < now + ms) {
/* do nothing */
}
}
getExecutionInfo(message) {
if (process.env.DEBUGGING) {
const port = Number.parseInt(process.env.DEBUG_PORT);
console.log(ATTACH_DEBUGGER_EVENT);
(0, node_inspector_1.open)(port, "127.0.0.1", true);
ExecutionStartingProcessor.sleepFor(1000);
}
const req = message;
return req.getCurrentexecutioninfo();
}
getApplicableHooks() {
return HookRegistry_1.default.get(this.hookType, []);
}
}
exports.ExecutionStartingProcessor = ExecutionStartingProcessor;