From 5692d52bb9154c6ecfbad66d0f0fd03cb968b056 Mon Sep 17 00:00:00 2001 From: Erfan Besharat Date: Mon, 9 Dec 2024 19:03:49 +0100 Subject: [PATCH] Fix worker in dev mode --- packages/cli/src/splitRunner/splitRunner.ts | 6 ++++-- packages/cli/src/splitRunner/worker.js | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 packages/cli/src/splitRunner/worker.js diff --git a/packages/cli/src/splitRunner/splitRunner.ts b/packages/cli/src/splitRunner/splitRunner.ts index 9c76c8d..b914292 100644 --- a/packages/cli/src/splitRunner/splitRunner.ts +++ b/packages/cli/src/splitRunner/splitRunner.ts @@ -15,7 +15,7 @@ class SplitRunner { async run(): Promise { console.info(`Splitting group: ${this.group.name}`); - console.time("Total Splitting Time"); + console.time(`${this.group.name ? `${this.group.name}-` : ""}total-time`); const worker = new Worker(path.resolve(__dirname, "worker"), { workerData: { @@ -27,7 +27,9 @@ class SplitRunner { return new Promise((resolve, reject) => { worker.on("message", (updatedFiles: File[]) => { - console.timeEnd("Total Splitting Time"); + console.timeEnd( + `${this.group.name ? `${this.group.name}-` : ""}total-time`, + ); resolve(updatedFiles); }); diff --git a/packages/cli/src/splitRunner/worker.js b/packages/cli/src/splitRunner/worker.js new file mode 100644 index 0000000..c0903aa --- /dev/null +++ b/packages/cli/src/splitRunner/worker.js @@ -0,0 +1,3 @@ +const path = require("path"); +require("ts-node").register(); +require(path.resolve(__dirname, "worker.ts"));