const tasksConcurrency = 2
const pool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/testWorker.js',
+ './tests/worker-files/thread/testWorker.mjs',
{
errorHandler: e => console.error(e)
}
)
const queuePool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/testWorker.js',
+ './tests/worker-files/thread/testWorker.mjs',
{
enableTasksQueue: true,
tasksQueueOptions: {
)
const emptyPool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/emptyWorker.js',
+ './tests/worker-files/thread/emptyWorker.mjs',
{ exitHandler: () => console.info('empty pool worker exited') }
)
const echoPool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/echoWorker.js'
+ './tests/worker-files/thread/echoWorker.mjs'
)
const errorPool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/errorWorker.js',
+ './tests/worker-files/thread/errorWorker.mjs',
{
errorHandler: e => console.error(e)
}
)
const asyncErrorPool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/asyncErrorWorker.js',
+ './tests/worker-files/thread/asyncErrorWorker.mjs',
{
errorHandler: e => console.error(e)
}
)
const asyncPool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/asyncWorker.js'
+ './tests/worker-files/thread/asyncWorker.mjs'
)
after('Destroy all pools', async () => {
it("Verify that 'ready' event is emitted", async () => {
const pool = new FixedThreadPool(
numberOfThreads,
- './tests/worker-files/thread/testWorker.js',
+ './tests/worker-files/thread/testWorker.mjs',
{
errorHandler: e => console.error(e)
}
})
it('Verify that thread pool options are checked', async () => {
- const workerFilePath = './tests/worker-files/thread/testWorker.js'
+ const workerFilePath = './tests/worker-files/thread/testWorker.mjs'
let pool = new FixedThreadPool(numberOfThreads, workerFilePath)
expect(pool.opts.workerOptions).toBeUndefined()
await pool.destroy()
})
it('Should work even without opts in input', async () => {
- const workerFilePath = './tests/worker-files/thread/testWorker.js'
+ const workerFilePath = './tests/worker-files/thread/testWorker.mjs'
const pool = new FixedThreadPool(numberOfThreads, workerFilePath)
const res = await pool.execute()
expect(res).toStrictEqual({ ok: 1 })
})
it('Verify destroyWorkerNode()', async () => {
- const workerFilePath = './tests/worker-files/thread/testWorker.js'
+ const workerFilePath = './tests/worker-files/thread/testWorker.mjs'
const pool = new FixedThreadPool(numberOfThreads, workerFilePath)
const workerNodeKey = 0
let exitEvent = 0
await pool.destroy()
})
- it('Verify that a pool with zero worker fails', async () => {
+ it('Verify that a pool with zero worker fails', () => {
expect(
- () => new FixedThreadPool(0, './tests/worker-files/thread/testWorker.js')
- ).toThrowError('Cannot instantiate a fixed pool with zero worker')
+ () => new FixedThreadPool(0, './tests/worker-files/thread/testWorker.mjs')
+ ).toThrow('Cannot instantiate a fixed pool with zero worker')
})
})