import { MessageChannel, Worker as ThreadWorker } from 'node:worker_threads'
import { Worker as ClusterWorker } 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'
+import { WorkerNode } from '../../lib/pools/worker-node.cjs'
+import { WorkerTypes } from '../../lib/index.cjs'
+import { CircularArray } from '../../lib/circular-array.cjs'
+import { Deque } from '../../lib/deque.cjs'
+import { DEFAULT_TASK_NAME } from '../../lib/utils.cjs'
describe('Worker node test suite', () => {
const threadWorkerNode = new WorkerNode(
)
const clusterWorkerNode = new WorkerNode(
WorkerTypes.cluster,
- './tests/worker-files/cluster/testWorker.js',
+ './tests/worker-files/cluster/testWorker.cjs',
{ tasksQueueBackPressureSize: 12 }
)
id: threadWorkerNode.worker.threadId,
type: WorkerTypes.thread,
dynamic: false,
- ready: false
+ ready: false,
+ stealing: false
})
expect(threadWorkerNode.usage).toStrictEqual({
tasks: {
id: clusterWorkerNode.worker.id,
type: WorkerTypes.cluster,
dynamic: false,
- ready: false
+ ready: false,
+ stealing: false
})
expect(clusterWorkerNode.usage).toStrictEqual({
tasks: {