import { describe, expect, it } from 'vitest'
-import { CircularBuffer, defaultBufferSize } from '../lib/circular-buffer.cjs'
+import { CircularBuffer, defaultBufferSize } from '../lib/circular-buffer.mjs'
describe('Circular buffer test suite', () => {
it('Verify that circular buffer can be instantiated', () => {
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
-import { CircularBuffer } from '../../lib/circular-buffer.cjs'
+import { CircularBuffer } from '../../lib/circular-buffer.mjs'
import {
DynamicClusterPool,
DynamicThreadPool,
PoolTypes,
WorkerChoiceStrategies,
WorkerTypes,
-} from '../../lib/index.cjs'
-import { WorkerNode } from '../../lib/pools/worker-node.cjs'
-import { PriorityQueue } from '../../lib/queues/priority-queue.cjs'
-import { defaultBucketSize } from '../../lib/queues/queue-types.cjs'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
+} from '../../lib/index.mjs'
+import { WorkerNode } from '../../lib/pools/worker-node.mjs'
+import { PriorityQueue } from '../../lib/queues/priority-queue.mjs'
+import { defaultBucketSize } from '../../lib/queues/queue-types.mjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.mjs'
import { waitPoolEvents } from '../test-utils.cjs'
describe('Abstract pool test suite', () => {
DynamicClusterPool,
PoolEvents,
WorkerChoiceStrategies,
-} from '../../../lib/index.cjs'
+} from '../../../lib/index.mjs'
import { TaskFunctions } from '../../test-types.cjs'
import { sleep, waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs'
import cluster from 'node:cluster'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
-import { FixedClusterPool, PoolEvents } from '../../../lib/index.cjs'
-import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
+import { FixedClusterPool, PoolEvents } from '../../../lib/index.mjs'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.mjs'
import { TaskFunctions } from '../../test-types.cjs'
import { sleep, waitWorkerEvents } from '../../test-utils.cjs'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
-import { FixedClusterPool, FixedThreadPool } from '../../../lib/index.cjs'
+import { FixedClusterPool, FixedThreadPool } from '../../../lib/index.mjs'
import {
buildWorkerChoiceStrategyOptions,
getWorkerChoiceStrategiesRetries,
-} from '../../../lib/pools/selection-strategies/selection-strategies-utils.cjs'
+} from '../../../lib/pools/selection-strategies/selection-strategies-utils.mjs'
describe('Selection strategies utils test suite', () => {
const numberOfWorkers = 4
import { randomInt } from 'node:crypto'
import { describe, expect, it } from 'vitest'
-import { CircularBuffer } from '../../../lib/circular-buffer.cjs'
+import { CircularBuffer } from '../../../lib/circular-buffer.mjs'
import {
DynamicClusterPool,
DynamicThreadPool,
FixedClusterPool,
FixedThreadPool,
WorkerChoiceStrategies,
-} from '../../../lib/index.cjs'
+} from '../../../lib/index.mjs'
describe('Selection strategies test suite', () => {
const min = 0
import { randomInt } from 'node:crypto'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
-import { FixedThreadPool } from '../../../lib/index.cjs'
-import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.cjs'
-import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.cjs'
-import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.cjs'
-import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.cjs'
-import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.cjs'
-import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.cjs'
-import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs'
+import { FixedThreadPool } from '../../../lib/index.mjs'
+import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.mjs'
+import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.mjs'
+import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.mjs'
+import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.mjs'
+import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.mjs'
+import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.mjs'
+import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.mjs'
describe('Weighted round robin worker choice strategy test suite', () => {
const max = 3
DynamicThreadPool,
FixedThreadPool,
WorkerChoiceStrategies,
-} from '../../../lib/index.cjs'
-import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.cjs'
-import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.cjs'
-import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.cjs'
-import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.cjs'
-import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.cjs'
-import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.cjs'
-import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.cjs'
-import { WorkerChoiceStrategiesContext } from '../../../lib/pools/selection-strategies/worker-choice-strategies-context.cjs'
+} from '../../../lib/index.mjs'
+import { FairShareWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy.mjs'
+import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.mjs'
+import { LeastBusyWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy.mjs'
+import { LeastEluWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-elu-worker-choice-strategy.mjs'
+import { LeastUsedWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/least-used-worker-choice-strategy.mjs'
+import { RoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy.mjs'
+import { WeightedRoundRobinWorkerChoiceStrategy } from '../../../lib/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.mjs'
+import { WorkerChoiceStrategiesContext } from '../../../lib/pools/selection-strategies/worker-choice-strategies-context.mjs'
describe('Worker choice strategies context test suite', () => {
const min = 1
DynamicThreadPool,
PoolEvents,
WorkerChoiceStrategies,
-} from '../../../lib/index.cjs'
+} from '../../../lib/index.mjs'
import { TaskFunctions } from '../../test-types.cjs'
import { sleep, waitPoolEvents, waitWorkerEvents } from '../../test-utils.cjs'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
-import { FixedThreadPool, PoolEvents } from '../../../lib/index.cjs'
-import { DEFAULT_TASK_NAME } from '../../../lib/utils.cjs'
+import { FixedThreadPool, PoolEvents } from '../../../lib/index.mjs'
+import { DEFAULT_TASK_NAME } from '../../../lib/utils.mjs'
import { TaskFunctions } from '../../test-types.cjs'
import { sleep, waitWorkerEvents } from '../../test-utils.cjs'
import { Worker as ThreadWorker } from 'node:worker_threads'
import { describe, expect, it } from 'vitest'
-import { CircularBuffer } from '../../lib/circular-buffer.cjs'
-import { WorkerTypes } from '../../lib/index.cjs'
+import { CircularBuffer } from '../../lib/circular-buffer.mjs'
+import { WorkerTypes } from '../../lib/index.mjs'
import {
checkValidWorkerNodeKeys,
createWorker,
getDefaultTasksQueueOptions,
initWorkerInfo,
updateMeasurementStatistics,
-} from '../../lib/pools/utils.cjs'
-import { MeasurementHistorySize } from '../../lib/pools/worker.cjs'
+} from '../../lib/pools/utils.mjs'
+import { MeasurementHistorySize } from '../../lib/pools/worker.mjs'
describe('Pool utils test suite', () => {
it('Verify DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS values', () => {
expect(
createWorker(
WorkerTypes.cluster,
- './tests/worker-files/cluster/testWorker.mjs',
+ './tests/worker-files/cluster/testWorker.cjs',
{}
)
).toBeInstanceOf(ClusterWorker)
})
const clusterWorker = createWorker(
WorkerTypes.cluster,
- './tests/worker-files/cluster/testWorker.mjs',
+ './tests/worker-files/cluster/testWorker.cjs',
{}
)
const clusterWorkerInfo = initWorkerInfo(clusterWorker)
import { MessageChannel, Worker as ThreadWorker } from 'node:worker_threads'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
-import { CircularBuffer } from '../../lib/circular-buffer.cjs'
-import { WorkerTypes } from '../../lib/index.cjs'
-import { WorkerNode } from '../../lib/pools/worker-node.cjs'
-import { MeasurementHistorySize } from '../../lib/pools/worker.cjs'
-import { PriorityQueue } from '../../lib/queues/priority-queue.cjs'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
+import { CircularBuffer } from '../../lib/circular-buffer.mjs'
+import { WorkerTypes } from '../../lib/index.mjs'
+import { WorkerNode } from '../../lib/pools/worker-node.mjs'
+import { MeasurementHistorySize } from '../../lib/pools/worker.mjs'
+import { PriorityQueue } from '../../lib/queues/priority-queue.mjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.mjs'
describe('Worker node test suite', () => {
let clusterWorkerNode, threadWorkerNode
import { useFakeTimers } from 'sinon'
import { describe, expect, it } from 'vitest'
-import { KillBehaviors } from '../lib/index.cjs'
+import { KillBehaviors } from '../lib/index.mjs'
import {
availableParallelism,
average,
round,
secureRandom,
sleep,
-} from '../lib/utils.cjs'
+} from '../lib/utils.mjs'
describe('Utils test suite', () => {
it('Verify DEFAULT_TASK_NAME value', () => {
import { describe, expect, it } from 'vitest'
-import { AbortError } from '../../lib/worker/abort-error.cjs'
+import { AbortError } from '../../lib/worker/abort-error.mjs'
describe('Abort error test suite', () => {
it('Verify constructor() behavior', () => {
KillBehaviors,
ThreadWorker,
WorkerChoiceStrategies,
-} from '../../lib/index.cjs'
-import { DEFAULT_TASK_NAME, EMPTY_FUNCTION } from '../../lib/utils.cjs'
+} from '../../lib/index.mjs'
+import { DEFAULT_TASK_NAME, EMPTY_FUNCTION } from '../../lib/utils.mjs'
describe('Abstract worker test suite', () => {
class StubWorkerWithMainWorker extends ThreadWorker {
import { restore, stub } from 'sinon'
import { afterEach, describe, expect, it } from 'vitest'
-import { ClusterWorker } from '../../lib/index.cjs'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
+import { ClusterWorker } from '../../lib/index.mjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.mjs'
describe('Cluster worker test suite', () => {
afterEach(() => {
import { restore, stub } from 'sinon'
import { afterEach, describe, expect, it } from 'vitest'
-import { ThreadWorker } from '../../lib/index.cjs'
-import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
+import { ThreadWorker } from '../../lib/index.mjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.mjs'
describe('Thread worker test suite', () => {
afterEach(() => {
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
- reportsDirectory: 'outputs/coverage',
thresholds: {
branches: 90,
functions: 90,