test: switch to ESM
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 29 Sep 2023 22:12:35 +0000 (00:12 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 29 Sep 2023 22:12:35 +0000 (00:12 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
17 files changed:
package.json
tests/circular-array.test.mjs [moved from tests/circular-array.test.js with 98% similarity]
tests/deque.test.mjs [moved from tests/deque.test.js with 98% similarity]
tests/pools/abstract-pool.test.mjs [moved from tests/pools/abstract-pool.test.js with 98% similarity]
tests/pools/cluster/dynamic.test.mjs [moved from tests/pools/cluster/dynamic.test.js with 95% similarity]
tests/pools/cluster/fixed.test.mjs [moved from tests/pools/cluster/fixed.test.js with 97% similarity]
tests/pools/selection-strategies/selection-strategies.test.mjs [moved from tests/pools/selection-strategies/selection-strategies.test.js with 99% similarity]
tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs [moved from tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.js with 70% similarity]
tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs [moved from tests/pools/selection-strategies/worker-choice-strategy-context.test.js with 89% similarity]
tests/pools/thread/dynamic.test.mjs [moved from tests/pools/thread/dynamic.test.js with 95% similarity]
tests/pools/thread/fixed.test.mjs [moved from tests/pools/thread/fixed.test.js with 97% similarity]
tests/pools/utils.test.mjs [moved from tests/pools/utils.test.js with 91% similarity]
tests/pools/worker-node.test.mjs [moved from tests/pools/worker-node.test.js with 94% similarity]
tests/utils.test.mjs [moved from tests/utils.test.js with 96% similarity]
tests/worker/abstract-worker.test.mjs [moved from tests/worker/abstract-worker.test.js with 96% similarity]
tests/worker/cluster-worker.test.mjs [moved from tests/worker/cluster-worker.test.js with 83% similarity]
tests/worker/thread-worker.test.mjs [moved from tests/worker/thread-worker.test.js with 90% similarity]

index 4fab7713cc916319a8a4697c19a7a3cd527845b7..d5bef2c8cc0ef590e5c7e6d482b4f247cd289678 100644 (file)
@@ -22,8 +22,8 @@
     "benchmark": "pnpm build && node -r source-map-support/register benchmarks/internal/bench.mjs",
     "benchmark:debug": "pnpm build && node -r source-map-support/register --inspect benchmarks/internal/bench.mjs",
     "benchmark:prod": "pnpm build:prod && node benchmarks/internal/bench.mjs",
-    "test": "pnpm build --environment SOURCEMAP:false && c8 mocha 'tests/**/*.test.js'",
-    "test:debug": "pnpm build && mocha --no-parallel --inspect 'tests/**/*.test.js'",
+    "test": "pnpm build --environment SOURCEMAP:false && c8 mocha 'tests/**/*.test.mjs'",
+    "test:debug": "pnpm build && mocha --no-parallel --inspect 'tests/**/*.test.mjs'",
     "coverage": "c8 report --reporter=lcov",
     "coverage:html": "c8 report --reporter=html",
     "format": "biome format . --write; ts-standard . --fix",
similarity index 98%
rename from tests/circular-array.test.js
rename to tests/circular-array.test.mjs
index fa87a31062f44bbae52ee74b5b1e180539c2afd7..0e13a8c32098a19a26c80dc26e2195ad7ee6a214 100644 (file)
@@ -1,8 +1,8 @@
-const { expect } = require('expect')
-const {
+import { expect } from 'expect'
+import {
   CircularArray,
   DEFAULT_CIRCULAR_ARRAY_SIZE
-} = require('../lib/circular-array')
+} from '../lib/circular-array.js'
 
 describe('Circular array test suite', () => {
   it('Verify that circular array can be instantiated', () => {
similarity index 98%
rename from tests/deque.test.js
rename to tests/deque.test.mjs
index 73e54590b3956e91ba7b1c2ad39e636c3fa92a95..6c8ebbb1e86389675c8136a892556986e5bd35b0 100644 (file)
@@ -1,5 +1,5 @@
-const { expect } = require('expect')
-const { Deque } = require('../lib/deque')
+import { expect } from 'expect'
+import { Deque } from '../lib/deque.js'
 
 describe('Deque test suite', () => {
   it('Verify push() behavior', () => {
similarity index 98%
rename from tests/pools/abstract-pool.test.js
rename to tests/pools/abstract-pool.test.mjs
index e6572cc1851a74a028e0a6a39f5478153fc57d32..09a21c9d1fb3a57fb654c5f29c44adf703c025ba 100644 (file)
@@ -1,7 +1,8 @@
-const { EventEmitterAsyncResource } = require('node:events')
-const { expect } = require('expect')
-const sinon = require('sinon')
-const {
+import { EventEmitterAsyncResource } from 'node:events'
+import { readFileSync } from 'node:fs'
+import { expect } from 'expect'
+import { restore, stub } from 'sinon'
+import {
   DynamicClusterPool,
   DynamicThreadPool,
   FixedClusterPool,
@@ -10,15 +11,15 @@ const {
   PoolTypes,
   WorkerChoiceStrategies,
   WorkerTypes
-} = require('../../lib')
-const { CircularArray } = require('../../lib/circular-array')
-const { Deque } = require('../../lib/deque')
-const { DEFAULT_TASK_NAME } = require('../../lib/utils')
-const { version } = require('../../package.json')
-const { waitPoolEvents } = require('../test-utils')
-const { WorkerNode } = require('../../lib/pools/worker-node')
+} from '../../lib/index.js'
+import { CircularArray } from '../../lib/circular-array.js'
+import { Deque } from '../../lib/deque.js'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.js'
+import { waitPoolEvents } from '../test-utils.js'
+import { WorkerNode } from '../../lib/pools/worker-node.js'
 
 describe('Abstract pool test suite', () => {
+  const version = JSON.parse(readFileSync('./package.json', 'utf8')).version
   const numberOfWorkers = 2
   class StubPoolWithIsMain extends FixedThreadPool {
     isMain () {
@@ -27,7 +28,7 @@ describe('Abstract pool test suite', () => {
   }
 
   afterEach(() => {
-    sinon.restore()
+    restore()
   })
 
   it('Simulate pool creation from a non main thread/process', () => {
@@ -1218,7 +1219,7 @@ describe('Abstract pool test suite', () => {
         enableTasksQueue: true
       }
     )
-    sinon.stub(pool, 'hasBackPressure').returns(true)
+    stub(pool, 'hasBackPressure').returns(true)
     expect(pool.emitter.eventNames()).toStrictEqual([])
     const promises = new Set()
     let poolBackPressure = 0
similarity index 95%
rename from tests/pools/cluster/dynamic.test.js
rename to tests/pools/cluster/dynamic.test.mjs
index 1e729eaef0252be71fa3848e15935b6c82604b61..edd9639036937143a64ee5c8a571cecc6c436f35 100644 (file)
@@ -1,7 +1,7 @@
-const { expect } = require('expect')
-const { DynamicClusterPool, PoolEvents } = require('../../../lib')
-const { TaskFunctions } = require('../../test-types')
-const { sleep, waitWorkerEvents } = require('../../test-utils')
+import { expect } from 'expect'
+import { DynamicClusterPool, PoolEvents } from '../../../lib/index.js'
+import { TaskFunctions } from '../../test-types.js'
+import { sleep, waitWorkerEvents } from '../../test-utils.js'
 
 describe('Dynamic cluster pool test suite', () => {
   const min = 1
similarity index 97%
rename from tests/pools/cluster/fixed.test.js
rename to tests/pools/cluster/fixed.test.mjs
index 9b79f6ed8eed5f0b1e3f2802769a857c35b818ea..7d829f32858e548e30d0325266adc0bdf637b13e 100644 (file)
@@ -1,8 +1,8 @@
-const { expect } = require('expect')
-const { FixedClusterPool, PoolEvents } = require('../../../lib')
-const { TaskFunctions } = require('../../test-types')
-const { waitPoolEvents, waitWorkerEvents } = require('../../test-utils')
-const { DEFAULT_TASK_NAME } = require('../../../lib/utils')
+import { expect } from 'expect'
+import { FixedClusterPool, PoolEvents } from '../../../lib/index.js'
+import { TaskFunctions } from '../../test-types.js'
+import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.js'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.js'
 
 describe('Fixed cluster pool test suite', () => {
   const numberOfWorkers = 8
similarity index 99%
rename from tests/pools/selection-strategies/selection-strategies.test.js
rename to tests/pools/selection-strategies/selection-strategies.test.mjs
index 3329e1dc718f3565202e1344479248013a6171c8..342d2fa6c997c0bfe1f696cfcecfefcce91931c2 100644 (file)
@@ -1,12 +1,12 @@
-const { expect } = require('expect')
-const {
+import { expect } from 'expect'
+import {
   DynamicClusterPool,
   DynamicThreadPool,
   FixedClusterPool,
   FixedThreadPool,
   WorkerChoiceStrategies
-} = require('../../../lib')
-const { CircularArray } = require('../../../lib/circular-array')
+} from '../../../lib/index.js'
+import { CircularArray } from '../../../lib/circular-array.js'
 
 describe('Selection strategies test suite', () => {
   const min = 0
similarity index 70%
rename from tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.js
rename to tests/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.test.mjs
index d774bce8346c9e05f31d77b4deb3f86f13c40012..c659b31e7bcc2dec1db31a0a7554b1b82cb6c549 100644 (file)
@@ -1,10 +1,8 @@
-const { expect } = require('expect')
-const sinon = require('sinon')
-const { FixedThreadPool } = require('../../../lib')
-const {
-  WeightedRoundRobinWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy')
-const { generateRandomInteger } = require('../../test-utils')
+import { expect } from 'expect'
+import { restore } from 'sinon'
+import { FixedThreadPool } from '../../../lib/index.js'
+import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.js'
+import { generateRandomInteger } from '../../test-utils.js'
 
 describe('Weighted round robin strategy worker choice strategy test suite', () => {
   // const min = 1
@@ -16,7 +14,7 @@ describe('Weighted round robin strategy worker choice strategy test suite', () =
   })
 
   afterEach(() => {
-    sinon.restore()
+    restore()
   })
 
   after(async () => {
similarity index 89%
rename from tests/pools/selection-strategies/worker-choice-strategy-context.test.js
rename to tests/pools/selection-strategies/worker-choice-strategy-context.test.mjs
index df8cd25cb375a4aa50db889c7b014e4c17b22f9c..f9b1c8d590ac39e9d8657bc9348456483808af0a 100644 (file)
@@ -1,34 +1,18 @@
-const { expect } = require('expect')
-const sinon = require('sinon')
-const {
-  FixedThreadPool,
+import { expect } from 'expect'
+import { createStubInstance, restore, stub } from 'sinon'
+import {
   DynamicThreadPool,
+  FixedThreadPool,
   WorkerChoiceStrategies
-} = require('../../../lib')
-const {
-  WorkerChoiceStrategyContext
-} = require('../../../lib/pools/selection-strategies/worker-choice-strategy-context')
-const {
-  RoundRobinWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy')
-const {
-  LeastUsedWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/least-used-worker-choice-strategy')
-const {
-  LeastBusyWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy')
-const {
-  LeastEluWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy')
-const {
-  FairShareWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy')
-const {
-  WeightedRoundRobinWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy')
-const {
-  InterleavedWeightedRoundRobinWorkerChoiceStrategy
-} = require('../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy')
+} from '../../../lib/index.js'
+import { WorkerChoiceStrategyContext } from '../../../lib/pools/selection-strategies/worker-choice-strategy-context.js'
+import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.js'
+import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.js'
+import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.js'
+import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.js'
+import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.js'
+import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.js'
+import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.js'
 
 describe('Worker choice strategy context test suite', () => {
   const min = 1
@@ -48,7 +32,7 @@ describe('Worker choice strategy context test suite', () => {
   })
 
   afterEach(() => {
-    sinon.restore()
+    restore()
   })
 
   after(async () => {
@@ -69,10 +53,10 @@ describe('Worker choice strategy context test suite', () => {
     const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       fixedPool
     )
-    const WorkerChoiceStrategyStub = sinon.createStubInstance(
+    const WorkerChoiceStrategyStub = createStubInstance(
       RoundRobinWorkerChoiceStrategy,
       {
-        choose: sinon.stub().returns(0)
+        choose: stub().returns(0)
       }
     )
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe(
@@ -95,16 +79,16 @@ describe('Worker choice strategy context test suite', () => {
     const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       fixedPool
     )
-    const WorkerChoiceStrategyUndefinedStub = sinon.createStubInstance(
+    const WorkerChoiceStrategyUndefinedStub = createStubInstance(
       RoundRobinWorkerChoiceStrategy,
       {
-        choose: sinon.stub().returns(undefined)
+        choose: stub().returns(undefined)
       }
     )
-    const WorkerChoiceStrategyNullStub = sinon.createStubInstance(
+    const WorkerChoiceStrategyNullStub = createStubInstance(
       RoundRobinWorkerChoiceStrategy,
       {
-        choose: sinon.stub().returns(null)
+        choose: stub().returns(null)
       }
     )
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe(
@@ -130,10 +114,10 @@ describe('Worker choice strategy context test suite', () => {
     const workerChoiceStrategyContext = new WorkerChoiceStrategyContext(
       dynamicPool
     )
-    const WorkerChoiceStrategyStub = sinon.createStubInstance(
+    const WorkerChoiceStrategyStub = createStubInstance(
       RoundRobinWorkerChoiceStrategy,
       {
-        choose: sinon.stub().returns(0)
+        choose: stub().returns(0)
       }
     )
     expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe(
similarity index 95%
rename from tests/pools/thread/dynamic.test.js
rename to tests/pools/thread/dynamic.test.mjs
index 1c5997ccf510baacc45c69337ec24965390b7e4d..0a608a01f2d9d478b9fc4a17c388bcb1ac89b4dd 100644 (file)
@@ -1,7 +1,7 @@
-const { expect } = require('expect')
-const { DynamicThreadPool, PoolEvents } = require('../../../lib')
-const { TaskFunctions } = require('../../test-types')
-const { sleep, waitWorkerEvents } = require('../../test-utils')
+import { expect } from 'expect'
+import { DynamicThreadPool, PoolEvents } from '../../../lib/index.js'
+import { TaskFunctions } from '../../test-types.js'
+import { sleep, waitWorkerEvents } from '../../test-utils.js'
 
 describe('Dynamic thread pool test suite', () => {
   const min = 1
similarity index 97%
rename from tests/pools/thread/fixed.test.js
rename to tests/pools/thread/fixed.test.mjs
index acd944067c4e134b5f0a2f0dd31fa57bebed3ccd..a1cb8dd294b100263e0bb97e898b2890e02d4c43 100644 (file)
@@ -1,8 +1,8 @@
-const { expect } = require('expect')
-const { FixedThreadPool, PoolEvents } = require('../../../lib')
-const { TaskFunctions } = require('../../test-types')
-const { waitPoolEvents, waitWorkerEvents } = require('../../test-utils')
-const { DEFAULT_TASK_NAME } = require('../../../lib/utils')
+import { expect } from 'expect'
+import { FixedThreadPool, PoolEvents } from '../../../lib/index.js'
+import { TaskFunctions } from '../../test-types.js'
+import { waitPoolEvents, waitWorkerEvents } from '../../test-utils.js'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.js'
 
 describe('Fixed thread pool test suite', () => {
   const numberOfThreads = 6
similarity index 91%
rename from tests/pools/utils.test.js
rename to tests/pools/utils.test.mjs
index 23ef2e2fd29280a4857cabbbbd4a6677a8bdae10..bf0c72afadadc78819bd5d938a30f962496f1fee 100644 (file)
@@ -1,9 +1,9 @@
-const { expect } = require('expect')
-const {
-  DEFAULT_CIRCULAR_ARRAY_SIZE,
-  CircularArray
-} = require('../../lib/circular-array')
-const { updateMeasurementStatistics } = require('../../lib/pools/utils')
+import { expect } from 'expect'
+import {
+  CircularArray,
+  DEFAULT_CIRCULAR_ARRAY_SIZE
+} from '../../lib/circular-array.js'
+import { updateMeasurementStatistics } from '../../lib/pools/utils.js'
 
 describe('Pool utils test suite', () => {
   it('Verify updateMeasurementStatistics() behavior', () => {
similarity index 94%
rename from tests/pools/worker-node.test.js
rename to tests/pools/worker-node.test.mjs
index bfbd5d8d148667576472d1d02efddd7121374685..0780db255d618cf913b782a8e1e957613d139d8e 100644 (file)
@@ -1,11 +1,11 @@
-const { MessageChannel, Worker } = require('node:worker_threads')
-const cluster = require('node:cluster')
-const { expect } = require('expect')
-const { WorkerNode } = require('../../lib/pools/worker-node')
-const { WorkerTypes } = require('../../lib')
-const { CircularArray } = require('../../lib/circular-array')
-const { Deque } = require('../../lib/deque')
-const { DEFAULT_TASK_NAME } = require('../../lib/utils')
+import { MessageChannel, Worker } from 'node:worker_threads'
+import cluster from 'node:cluster'
+import { expect } from 'expect'
+import { WorkerNode } from '../../lib/pools/worker-node.js'
+import { WorkerTypes } from '../../lib/index.js'
+import { CircularArray } from '../../lib/circular-array.js'
+import { Deque } from '../../lib/deque.js'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.js'
 
 describe('Worker node test suite', () => {
   const threadWorker = new Worker('./tests/worker-files/thread/testWorker.js')
similarity index 96%
rename from tests/utils.test.js
rename to tests/utils.test.mjs
index 061c1648d4f2217583f6b0a9370802578fb222a6..74c53a1629b7f3ef7738bdbc50e3f908216457dd 100644 (file)
@@ -1,9 +1,9 @@
-const { randomInt } = require('node:crypto')
-const { Worker } = require('node:worker_threads')
-const cluster = require('node:cluster')
-const os = require('node:os')
-const { expect } = require('expect')
-const {
+import { Worker } from 'node:worker_threads'
+import cluster from 'node:cluster'
+import os from 'node:os'
+import { randomInt } from 'node:crypto'
+import { expect } from 'expect'
+import {
   DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
   DEFAULT_TASK_NAME,
   DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS,
@@ -11,8 +11,8 @@ const {
   availableParallelism,
   average,
   exponentialDelay,
-  getWorkerType,
   getWorkerId,
+  getWorkerType,
   isAsyncFunction,
   isKillBehavior,
   isPlainObject,
@@ -22,8 +22,8 @@ const {
   round,
   secureRandom,
   sleep
-} = require('../lib/utils')
-const { KillBehaviors, WorkerTypes } = require('../lib')
+} from '../lib/utils.js'
+import { KillBehaviors, WorkerTypes } from '../lib/index.js'
 
 describe('Utils test suite', () => {
   it('Verify DEFAULT_TASK_NAME value', () => {
similarity index 96%
rename from tests/worker/abstract-worker.test.js
rename to tests/worker/abstract-worker.test.mjs
index 1b055217b3e6405b59bf492980e578b1c600ef78..9058790b46654acbd2ea7ecc17ca0e38617dad3e 100644 (file)
@@ -1,7 +1,7 @@
-const { expect } = require('expect')
-const sinon = require('sinon')
-const { ClusterWorker, KillBehaviors, ThreadWorker } = require('../../lib')
-const { DEFAULT_TASK_NAME, EMPTY_FUNCTION } = require('../../lib/utils')
+import { expect } from 'expect'
+import { restore, stub } from 'sinon'
+import { ClusterWorker, KillBehaviors, ThreadWorker } from '../../lib/index.js'
+import { DEFAULT_TASK_NAME, EMPTY_FUNCTION } from '../../lib/utils.js'
 
 describe('Abstract worker test suite', () => {
   class StubWorkerWithMainWorker extends ThreadWorker {
@@ -12,7 +12,7 @@ describe('Abstract worker test suite', () => {
   }
 
   afterEach(() => {
-    sinon.restore()
+    restore()
   })
 
   it('Verify worker options default values', () => {
@@ -178,12 +178,12 @@ describe('Abstract worker test suite', () => {
 
   it('Verify that sync kill handler is called when worker is killed', () => {
     const worker = new ClusterWorker(() => {}, {
-      killHandler: sinon.stub().returns()
+      killHandler: stub().returns()
     })
     worker.isMain = false
-    worker.getMainWorker = sinon.stub().returns({
+    worker.getMainWorker = stub().returns({
       id: 1,
-      send: sinon.stub().returns()
+      send: stub().returns()
     })
     worker.handleKillMessage()
     expect(worker.getMainWorker().send.calledOnce).toBe(true)
@@ -191,7 +191,7 @@ describe('Abstract worker test suite', () => {
   })
 
   it('Verify that async kill handler is called when worker is killed', () => {
-    const killHandlerStub = sinon.stub().returns()
+    const killHandlerStub = stub().returns()
     const worker = new ClusterWorker(() => {}, {
       killHandler: async () => Promise.resolve(killHandlerStub())
     })
@@ -308,9 +308,9 @@ describe('Abstract worker test suite', () => {
       status: false,
       error: new TypeError('name parameter is an empty string')
     })
-    worker.getMainWorker = sinon.stub().returns({
+    worker.getMainWorker = stub().returns({
       id: 1,
-      send: sinon.stub().returns()
+      send: stub().returns()
     })
     expect(worker.taskFunctions.get(DEFAULT_TASK_NAME)).toBeInstanceOf(Function)
     expect(worker.taskFunctions.get('fn1')).toBeInstanceOf(Function)
similarity index 83%
rename from tests/worker/cluster-worker.test.js
rename to tests/worker/cluster-worker.test.mjs
index f857412bb8820690e887d7167a43515edd20dedd..ea6a0481c00e9a5ae1c2af65882fb51c88158fb6 100644 (file)
@@ -1,5 +1,5 @@
-const { expect } = require('expect')
-const { ClusterWorker } = require('../../lib')
+import { expect } from 'expect'
+import { ClusterWorker } from '../../lib/index.js'
 
 describe('Cluster worker test suite', () => {
   let numberOfMessagesSent = 0
similarity index 90%
rename from tests/worker/thread-worker.test.js
rename to tests/worker/thread-worker.test.mjs
index 495e10b13b92e2ff663ff1de551b65028a8a3841..8b6f9c79915602f4f1c2916be72833a8f69c25b3 100644 (file)
@@ -1,5 +1,5 @@
-const { expect } = require('expect')
-const { ThreadWorker } = require('../../lib')
+import { expect } from 'expect'
+import { ThreadWorker } from '../../lib/index.js'
 
 describe('Thread worker test suite', () => {
   let numberOfMessagesPosted = 0