skutter
Version:
Skutter: Opinionated BDD Browser based test framework
19 lines (18 loc) • 1.04 kB
JavaScript
;
const child_process = require("child_process");
const executor_proxy_1 = require("../orchestrator/executor-proxy");
const executor_message_listener_1 = require("../orchestrator/executor-message-listener");
class ExecutorProxyFactory {
constructor(executorMessageListener, executorConfig, outputRootPath) {
this.executorMessageListener = executorMessageListener;
this.executorConfig = executorConfig;
this.outputRootPath = outputRootPath;
}
create(bootstrapScriptPath, nodeOpts) {
let executorProcess = child_process.fork(bootstrapScriptPath, [], nodeOpts);
executorProcess.on("message", (payload) => { this.executorMessageListener.onMessage(payload); });
executorProcess.on("exit", (code, signal) => executor_message_listener_1.ExecutorMessageListener.onExit(executorProcess.pid, code, signal));
return new executor_proxy_1.ExecutorProxy(executorProcess, this.executorConfig, this.outputRootPath);
}
}
exports.ExecutorProxyFactory = ExecutorProxyFactory;