]> Piment Noir Git Repositories - poolifier.git/commitdiff
test: use ESM imports in worker threads files
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 23 Feb 2026 11:34:37 +0000 (12:34 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 23 Feb 2026 11:34:37 +0000 (12:34 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/utils.ts
tests/worker-files/thread/asyncErrorWorker.mjs
tests/worker-files/thread/asyncWorker.mjs
tests/worker-files/thread/echoWorker.mjs
tests/worker-files/thread/emptyWorker.mjs
tests/worker-files/thread/errorWorker.mjs
tests/worker-files/thread/longRunningWorkerHardBehavior.mjs
tests/worker-files/thread/longRunningWorkerSoftBehavior.mjs
tests/worker-files/thread/testMultipleTaskFunctionsWorker.mjs
tests/worker-files/thread/testTaskFunctionObjectsWorker.mjs
tests/worker-files/thread/testWorker.mjs

index 51634ee7a2ce61a2aea464b48fc2e81fce349c18..8961a87d4fc07efb6e6b2170eaa9ef3afed3fe95 100644 (file)
@@ -1,6 +1,5 @@
 import cluster, { Worker as ClusterWorker } from 'node:cluster'
 import { existsSync } from 'node:fs'
-import { env } from 'node:process'
 import {
   SHARE_ENV,
   Worker as ThreadWorker,
@@ -364,10 +363,7 @@ const updateMeasurementStatistics = (
     }
   }
 }
-if (env.NODE_ENV === 'test') {
-  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-  exports.updateMeasurementStatistics = updateMeasurementStatistics
-}
+export { updateMeasurementStatistics }
 
 export const updateWaitTimeWorkerUsage = <
   Worker extends IWorker,
index 917ded48fd49f77132317b8ba8d709b4e3fc5e63..9030df157f357121e5d88b09bbcef7c34df7fc16 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
index e72e9798d0d77a68d092ad6c824afbb4a919305b..3e43f744aab375dff46a4ca84acd863bce567349 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
index 4bee1c2dc7aaeb517f1a52a553424ab6e4045a9c..cc1638d551f3f17dba43a2d38fc72e7ccbc0ab27 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 
 /**
  * Test worker function that echoes the input data.
index 7d37eb95e9f012cf7237902b51300fb8f7ac0113..8259db1a36d98de5e3d143afddd035a18f8ab945 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 
 /**
  *
index 582d094ea39a8e7b9cea8286d4c51327da19e898..10fa89337dc5d09e8cc9b9e55d6eb496ba82e8ea 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 
 /**
  *
index 05ffe47a48a5ba53bff93b328d59bbb2d647bcf3..374c3f71678daf2560741200cceed7597d9b7e5c 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
index 45dc3894b4ae17674ee401f60a35f1ccaafef481..af960b5211a3903548a2740fbf4c2607fdad963b 100644 (file)
@@ -1,4 +1,4 @@
-import { ThreadWorker } from '../../../lib/index.cjs'
+import { ThreadWorker } from '../../../lib/index.mjs'
 import { sleepTaskFunction } from '../../test-utils.cjs'
 
 /**
index f78d3180a97cf4990b97ebf751f362297487c37f..36c7fc874f687959ee8f3b562012babb26d65ec7 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 import {
   factorial,
   fibonacci,
index 70251dd283879b416b18dfdfc8f6218c6a9a3754..1a3c903a04c9a55173b5104261129fbeaf4825e0 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 import {
   factorial,
   fibonacci,
index 9e32858afda214132071034da7ace6602920bac4..71b48715a53f0be1aa1f6166217148e7caeeb0d8 100644 (file)
@@ -1,4 +1,4 @@
-import { KillBehaviors, ThreadWorker } from '../../../lib/index.cjs'
+import { KillBehaviors, ThreadWorker } from '../../../lib/index.mjs'
 import { TaskFunctions } from '../../test-types.cjs'
 import { executeTaskFunction } from '../../test-utils.cjs'