refactor: refine prettier configuration
[poolifier.git] / tests / pools / selection-strategies / selection-strategies.test.mjs
index 342d2fa6c997c0bfe1f696cfcecfefcce91931c2..bca3c82b1647e22146b6094321d7c9ac60485403 100644 (file)
@@ -5,8 +5,8 @@ import {
   FixedClusterPool,
   FixedThreadPool,
   WorkerChoiceStrategies
-} from '../../../lib/index.js'
-import { CircularArray } from '../../../lib/circular-array.js'
+} from '../../../lib/index.cjs'
+import { CircularArray } from '../../../lib/circular-array.cjs'
 
 describe('Selection strategies test suite', () => {
   const min = 0
@@ -30,7 +30,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     expect(pool.opts.workerChoiceStrategy).toBe(
       WorkerChoiceStrategies.ROUND_ROBIN
@@ -43,7 +43,7 @@ describe('Selection strategies test suite', () => {
     for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
       const pool = new FixedThreadPool(
         max,
-        './tests/worker-files/thread/testWorker.js',
+        './tests/worker-files/thread/testWorker.mjs',
         { workerChoiceStrategy }
       )
       expect(pool.opts.workerChoiceStrategy).toBe(workerChoiceStrategy)
@@ -59,50 +59,26 @@ describe('Selection strategies test suite', () => {
       const pool = new DynamicThreadPool(
         min,
         max,
-        './tests/worker-files/thread/testWorker.js'
+        './tests/worker-files/thread/testWorker.mjs'
       )
       pool.setWorkerChoiceStrategy(workerChoiceStrategy)
       expect(pool.opts.workerChoiceStrategy).toBe(workerChoiceStrategy)
       expect(pool.workerChoiceStrategyContext.workerChoiceStrategy).toBe(
         workerChoiceStrategy
       )
-      expect(pool.opts.workerChoiceStrategyOptions).toStrictEqual({
-        retries: 6,
-        runTime: { median: false },
-        waitTime: { median: false },
-        elu: { median: false }
-      })
-      expect(pool.workerChoiceStrategyContext.opts).toStrictEqual({
-        retries: 6,
-        runTime: { median: false },
-        waitTime: { median: false },
-        elu: { median: false }
-      })
       await pool.destroy()
     }
     for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
       const pool = new DynamicClusterPool(
         min,
         max,
-        './tests/worker-files/cluster/testWorker.js'
+        './tests/worker-files/cluster/testWorker.cjs'
       )
-      pool.setWorkerChoiceStrategy(workerChoiceStrategy, { retries: 3 })
+      pool.setWorkerChoiceStrategy(workerChoiceStrategy)
       expect(pool.opts.workerChoiceStrategy).toBe(workerChoiceStrategy)
       expect(pool.workerChoiceStrategyContext.workerChoiceStrategy).toBe(
         workerChoiceStrategy
       )
-      expect(pool.opts.workerChoiceStrategyOptions).toStrictEqual({
-        retries: 3,
-        runTime: { median: false },
-        waitTime: { median: false },
-        elu: { median: false }
-      })
-      expect(pool.workerChoiceStrategyContext.opts).toStrictEqual({
-        retries: 3,
-        runTime: { median: false },
-        waitTime: { median: false },
-        elu: { median: false }
-      })
       await pool.destroy()
     }
   })
@@ -110,7 +86,7 @@ describe('Selection strategies test suite', () => {
   it('Verify available strategies default internals at pool creation', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
       expect(
@@ -126,11 +102,6 @@ describe('Selection strategies test suite', () => {
       if (
         workerChoiceStrategy === WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
       ) {
-        expect(
-          pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-            workerChoiceStrategy
-          ).defaultWorkerWeight
-        ).toBeGreaterThan(0)
         expect(
           pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
             workerChoiceStrategy
@@ -140,11 +111,6 @@ describe('Selection strategies test suite', () => {
         workerChoiceStrategy ===
         WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
       ) {
-        expect(
-          pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-            workerChoiceStrategy
-          ).defaultWorkerWeight
-        ).toBeGreaterThan(0)
         expect(
           pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
             workerChoiceStrategy
@@ -163,12 +129,15 @@ describe('Selection strategies test suite', () => {
         expect(
           pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
             workerChoiceStrategy
-          ).roundWeights
-        ).toStrictEqual([
-          pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-            workerChoiceStrategy
-          ).defaultWorkerWeight
-        ])
+          ).roundWeights.length
+        ).toBe(1)
+        expect(
+          Number.isSafeInteger(
+            pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+              workerChoiceStrategy
+            ).roundWeights[0]
+          )
+        ).toBe(true)
       }
     }
     await pool.destroy()
@@ -178,7 +147,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -189,7 +158,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -204,7 +173,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -230,7 +199,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -260,7 +229,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
@@ -277,6 +246,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -315,7 +285,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     // TODO: Create a better test to cover `RoundRobinWorkerChoiceStrategy#choose`
@@ -332,6 +302,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -373,23 +344,23 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
     let pool = new FixedClusterPool(
       max,
-      './tests/worker-files/cluster/testWorker.js',
+      './tests/worker-files/cluster/testWorker.cjs',
       { workerChoiceStrategy }
     )
     let results = new Set()
     for (let i = 0; i < max; i++) {
-      results.add(pool.workerNodes[pool.chooseWorkerNode()].worker.id)
+      results.add(pool.workerNodes[pool.chooseWorkerNode()].info.id)
     }
     expect(results.size).toBe(max)
     await pool.destroy()
     pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     results = new Set()
     for (let i = 0; i < max; i++) {
-      results.add(pool.workerNodes[pool.chooseWorkerNode()].worker.threadId)
+      results.add(pool.workerNodes[pool.chooseWorkerNode()].info.id)
     }
     expect(results.size).toBe(max)
     await pool.destroy()
@@ -399,7 +370,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
     )
     expect(
@@ -427,7 +398,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
     )
     expect(
@@ -459,7 +430,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -470,7 +441,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -485,7 +456,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -511,7 +482,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -540,7 +511,7 @@ describe('Selection strategies test suite', () => {
   it('Verify LEAST_USED strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED }
     )
     // TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#choose`
@@ -557,6 +528,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -598,7 +570,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED }
     )
     // TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#choose`
@@ -615,6 +587,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -656,7 +629,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -667,7 +640,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -682,7 +655,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -708,7 +681,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -737,7 +710,7 @@ describe('Selection strategies test suite', () => {
   it('Verify LEAST_BUSY strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY }
     )
     // TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#choose`
@@ -754,6 +727,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -805,7 +779,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY }
     )
     // TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#choose`
@@ -822,6 +796,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -873,7 +848,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_ELU
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -884,7 +859,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -899,7 +874,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_ELU
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -925,7 +900,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -954,7 +929,7 @@ describe('Selection strategies test suite', () => {
   it('Verify LEAST_ELU strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_ELU }
     )
     // TODO: Create a better test to cover `LeastEluWorkerChoiceStrategy#choose`
@@ -971,6 +946,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1028,7 +1004,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_ELU }
     )
     // TODO: Create a better test to cover `LeastEluWorkerChoiceStrategy#choose`
@@ -1045,6 +1021,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1102,7 +1079,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -1113,7 +1090,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -1128,7 +1105,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -1154,7 +1131,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -1183,7 +1160,7 @@ describe('Selection strategies test suite', () => {
   it('Verify FAIR_SHARE strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE }
     )
     // TODO: Create a better test to cover `FairShareChoiceStrategy#choose`
@@ -1200,6 +1177,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1268,7 +1246,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE }
     )
     // TODO: Create a better test to cover `FairShareChoiceStrategy#choose`
@@ -1285,6 +1263,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1353,7 +1332,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       {
         workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE,
         workerChoiceStrategyOptions: {
@@ -1375,6 +1354,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1443,7 +1423,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.FAIR_SHARE
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     for (const workerNode of pool.workerNodes) {
       workerNode.strategyData = {
@@ -1458,7 +1438,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     for (const workerNode of pool.workerNodes) {
       workerNode.strategyData = {
@@ -1477,7 +1457,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -1488,7 +1468,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -1503,7 +1483,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -1529,7 +1509,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -1558,7 +1538,7 @@ describe('Selection strategies test suite', () => {
   it('Verify WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
     )
     // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose`
@@ -1575,6 +1555,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1617,12 +1598,7 @@ describe('Selection strategies test suite', () => {
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
-    ).toBe(0)
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -1636,7 +1612,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
     )
     // TODO: Create a better test to cover `WeightedRoundRobinWorkerChoiceStrategy#choose`
@@ -1653,6 +1629,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1690,17 +1667,12 @@ describe('Selection strategies test suite', () => {
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).nextWorkerNodeKey
-    ).toBe(0)
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
-    ).toBe(0)
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -1714,7 +1686,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       {
         workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN,
         workerChoiceStrategyOptions: {
@@ -1736,6 +1708,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -1773,17 +1746,12 @@ describe('Selection strategies test suite', () => {
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).nextWorkerNodeKey
-    ).toBe(0)
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
-    ).toBe(0)
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -1797,7 +1765,7 @@ describe('Selection strategies test suite', () => {
     const workerChoiceStrategy = WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
@@ -1809,11 +1777,6 @@ describe('Selection strategies test suite', () => {
         workerChoiceStrategy
       ).previousWorkerNodeKey
     ).toBeDefined()
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeDefined()
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
@@ -1830,11 +1793,6 @@ describe('Selection strategies test suite', () => {
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
     ).toBe(0)
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -1844,7 +1802,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
@@ -1856,11 +1814,6 @@ describe('Selection strategies test suite', () => {
         workerChoiceStrategy
       ).previousWorkerNodeKey
     ).toBeDefined()
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeDefined()
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
@@ -1877,11 +1830,6 @@ describe('Selection strategies test suite', () => {
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
     ).toBe(0)
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -1896,7 +1844,7 @@ describe('Selection strategies test suite', () => {
       WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -1907,7 +1855,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(pool.workerChoiceStrategyContext.getStrategyPolicy()).toStrictEqual({
@@ -1923,7 +1871,7 @@ describe('Selection strategies test suite', () => {
       WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -1949,7 +1897,7 @@ describe('Selection strategies test suite', () => {
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       { workerChoiceStrategy }
     )
     expect(
@@ -1978,7 +1926,7 @@ describe('Selection strategies test suite', () => {
   it('Verify INTERLEAVED_WEIGHTED_ROUND_ROBIN strategy can be run in a fixed pool', async () => {
     const pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       {
         workerChoiceStrategy:
           WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
@@ -1998,6 +1946,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -2021,11 +1970,6 @@ describe('Selection strategies test suite', () => {
         max * maxMultiplier
       )
     }
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -2045,16 +1989,19 @@ describe('Selection strategies test suite', () => {
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
-    ).toEqual(expect.any(Number))
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).roundWeights
-    ).toStrictEqual([
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ])
+      ).roundWeights.length
+    ).toBe(1)
+    expect(
+      Number.isSafeInteger(
+        pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+          pool.workerChoiceStrategyContext.workerChoiceStrategy
+        ).roundWeights[0]
+      )
+    ).toBe(true)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -2063,7 +2010,7 @@ describe('Selection strategies test suite', () => {
     const pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js',
+      './tests/worker-files/thread/testWorker.mjs',
       {
         workerChoiceStrategy:
           WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
@@ -2083,6 +2030,7 @@ describe('Selection strategies test suite', () => {
           executing: 0,
           queued: 0,
           maxQueued: 0,
+          sequentiallyStolen: 0,
           stolen: 0,
           failed: 0
         },
@@ -2106,11 +2054,6 @@ describe('Selection strategies test suite', () => {
         max * maxMultiplier
       )
     }
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
@@ -2130,16 +2073,19 @@ describe('Selection strategies test suite', () => {
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
       ).previousWorkerNodeKey
-    ).toEqual(expect.any(Number))
+    ).toEqual(0)
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).roundWeights
-    ).toStrictEqual([
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ])
+      ).roundWeights.length
+    ).toBe(1)
+    expect(
+      Number.isSafeInteger(
+        pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+          pool.workerChoiceStrategyContext.workerChoiceStrategy
+        ).roundWeights[0]
+      )
+    ).toBe(true)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -2149,7 +2095,7 @@ describe('Selection strategies test suite', () => {
       WorkerChoiceStrategies.INTERLEAVED_WEIGHTED_ROUND_ROBIN
     let pool = new FixedThreadPool(
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
@@ -2171,11 +2117,6 @@ describe('Selection strategies test suite', () => {
         workerChoiceStrategy
       ).previousWorkerNodeKey
     ).toBeDefined()
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeDefined()
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
@@ -2205,22 +2146,20 @@ describe('Selection strategies test suite', () => {
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
+      ).roundWeights.length
+    ).toBe(1)
     expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).roundWeights
-    ).toStrictEqual([
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ])
+      Number.isSafeInteger(
+        pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+          pool.workerChoiceStrategyContext.workerChoiceStrategy
+        ).roundWeights[0]
+      )
+    ).toBe(true)
     await pool.destroy()
     pool = new DynamicThreadPool(
       min,
       max,
-      './tests/worker-files/thread/testWorker.js'
+      './tests/worker-files/thread/testWorker.mjs'
     )
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
@@ -2242,11 +2181,6 @@ describe('Selection strategies test suite', () => {
         workerChoiceStrategy
       ).previousWorkerNodeKey
     ).toBeDefined()
-    expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeDefined()
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         workerChoiceStrategy
@@ -2276,17 +2210,15 @@ describe('Selection strategies test suite', () => {
     expect(
       pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
         pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ).toBeGreaterThan(0)
+      ).roundWeights.length
+    ).toBe(1)
     expect(
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).roundWeights
-    ).toStrictEqual([
-      pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
-        pool.workerChoiceStrategyContext.workerChoiceStrategy
-      ).defaultWorkerWeight
-    ])
+      Number.isSafeInteger(
+        pool.workerChoiceStrategyContext.workerChoiceStrategies.get(
+          pool.workerChoiceStrategyContext.workerChoiceStrategy
+        ).roundWeights[0]
+      )
+    ).toBe(true)
     // We need to clean up the resources after our test
     await pool.destroy()
   })
@@ -2297,9 +2229,9 @@ describe('Selection strategies test suite', () => {
         new DynamicThreadPool(
           min,
           max,
-          './tests/worker-files/thread/testWorker.js',
+          './tests/worker-files/thread/testWorker.mjs',
           { workerChoiceStrategy: 'UNKNOWN_STRATEGY' }
         )
-    ).toThrowError("Invalid worker choice strategy 'UNKNOWN_STRATEGY'")
+    ).toThrow("Invalid worker choice strategy 'UNKNOWN_STRATEGY'")
   })
 })