From 292ad316a2815762f2e4a822383f1aef5ae49774 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 7 Mar 2021 19:28:25 +0100 Subject: [PATCH] Benchmarks and tests code cleanups. (#257) Co-authored-by: Shinigami --- benchmarks/internal/bench.js | 28 ++- benchmarks/internal/benchmark-utils.js | 9 +- benchmarks/internal/choose-worker.js | 10 +- benchmarks/internal/cluster/fixed.js | 19 +- benchmarks/internal/quick-select.js | 68 ++---- benchmarks/internal/thread/fixed.js | 19 +- .../{BENCH-100000.MD => BENCH-100000.md} | 0 .../versus-external-pools/package-lock.json | 75 +++++-- benchmarks/versus-external-pools/package.json | 2 +- examples/dynamicExample.js | 2 +- .../{staticExample.js => fixedExample.js} | 2 +- package-lock.json | 207 ++++++++++++------ tests/pools/abstract/abstract-pool.test.js | 7 +- tests/pools/cluster/dynamic.test.js | 14 +- tests/pools/cluster/fixed.test.js | 2 +- tests/pools/thread/dynamic.test.js | 6 +- tests/pools/thread/fixed.test.js | 6 +- tests/worker/abstract-worker.test.js | 4 +- 18 files changed, 309 insertions(+), 171 deletions(-) rename benchmarks/versus-external-pools/{BENCH-100000.MD => BENCH-100000.md} (100%) rename examples/{staticExample.js => fixedExample.js} (92%) diff --git a/benchmarks/internal/bench.js b/benchmarks/internal/bench.js index c3db7165..bdb2f614 100644 --- a/benchmarks/internal/bench.js +++ b/benchmarks/internal/bench.js @@ -3,20 +3,22 @@ const { dynamicClusterTest, dynamicClusterTestLessRecentlyUsed } = require('./cluster/dynamic') -const { fixedClusterTest } = require('./cluster/fixed') +const { + fixedClusterTest, + fixedClusterTestLessRecentlyUsed +} = require('./cluster/fixed') const { dynamicThreadTest, dynamicThreadTestLessRecentlyUsed } = require('./thread/dynamic') -const { fixedThreadTest } = require('./thread/fixed') +const { + fixedThreadTest, + fixedThreadTestLessRecentlyUsed +} = require('./thread/fixed') +const { LIST_FORMATTER } = require('./benchmark-utils') const suite = new Benchmark.Suite('poolifier') -const LIST_FORMATTER = new Intl.ListFormat('en-US', { - style: 'long', - type: 'conjunction' -}) - // Wait some seconds before start, pools need to load threads !!! setTimeout(async () => { test() @@ -25,18 +27,24 @@ setTimeout(async () => { async function test () { // Add tests suite - .add('Poolifier:Static:ThreadPool', async function () { + .add('Poolifier:Fixed:ThreadPool', async function () { await fixedThreadTest() }) + .add('Poolifier:Fixed:ThreadPool:LessRecentlyUsed', async function () { + await fixedThreadTestLessRecentlyUsed() + }) .add('Poolifier:Dynamic:ThreadPool', async function () { await dynamicThreadTest() }) .add('Poolifier:Dynamic:ThreadPool:LessRecentlyUsed', async function () { await dynamicThreadTestLessRecentlyUsed() }) - .add('Poolifier:Static:ClusterPool', async function () { + .add('Poolifier:Fixed:ClusterPool', async function () { await fixedClusterTest() }) + .add('Poolifier:Fixed:ClusterPool:LessRecentlyUsed', async function () { + await fixedClusterTestLessRecentlyUsed() + }) .add('Poolifier:Dynamic:ClusterPool', async function () { await dynamicClusterTest() }) @@ -55,5 +63,5 @@ async function test () { // eslint-disable-next-line no-process-exit process.exit() }) - .run({ async: true, queued: true }) + .run({ async: true }) } diff --git a/benchmarks/internal/benchmark-utils.js b/benchmarks/internal/benchmark-utils.js index cbf69307..878c2cae 100644 --- a/benchmarks/internal/benchmark-utils.js +++ b/benchmarks/internal/benchmark-utils.js @@ -1,7 +1,7 @@ async function runPoolifierTest (pool, { tasks, workerData }) { return new Promise((resolve, reject) => { let executions = 0 - for (let i = 0; i <= tasks; i++) { + for (let i = 1; i <= tasks; i++) { pool .execute(workerData) .then(res => { @@ -23,4 +23,9 @@ function generateRandomInteger (max, min = 0) { return Math.floor(Math.random() * max + 1) } -module.exports = { runPoolifierTest, generateRandomInteger } +const LIST_FORMATTER = new Intl.ListFormat('en-US', { + style: 'long', + type: 'conjunction' +}) + +module.exports = { generateRandomInteger, LIST_FORMATTER, runPoolifierTest } diff --git a/benchmarks/internal/choose-worker.js b/benchmarks/internal/choose-worker.js index 92eadfe4..e4e727a2 100644 --- a/benchmarks/internal/choose-worker.js +++ b/benchmarks/internal/choose-worker.js @@ -1,13 +1,13 @@ const Benchmark = require('benchmark') +const { LIST_FORMATTER } = require('./benchmark-utils') const suite = new Benchmark.Suite() -const LIST_FORMATTER = new Intl.ListFormat('en-US', { - style: 'long', - type: 'conjunction' -}) +function generateWorkersArray (numberOfWorkers) { + return [...Array(numberOfWorkers).keys()] +} -const workers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +const workers = generateWorkersArray(60) let nextWorkerIndex = 0 diff --git a/benchmarks/internal/cluster/fixed.js b/benchmarks/internal/cluster/fixed.js index 62c19aab..ea61c7fc 100644 --- a/benchmarks/internal/cluster/fixed.js +++ b/benchmarks/internal/cluster/fixed.js @@ -1,4 +1,7 @@ -const { FixedClusterPool } = require('../../../lib/index') +const { + FixedClusterPool, + WorkerChoiceStrategies +} = require('../../../lib/index') const { runPoolifierTest } = require('../benchmark-utils') const size = 30 @@ -8,10 +11,22 @@ const fixedPool = new FixedClusterPool( './benchmarks/internal/cluster/worker.js' ) +const fixedPoolLessRecentlyUsed = new FixedClusterPool( + size, + './benchmarks/internal/cluster/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } +) + async function fixedClusterTest ( { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } ) { return runPoolifierTest(fixedPool, { tasks, workerData }) } -module.exports = { fixedClusterTest } +async function fixedClusterTestLessRecentlyUsed ( + { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) +} + +module.exports = { fixedClusterTest, fixedClusterTestLessRecentlyUsed } diff --git a/benchmarks/internal/quick-select.js b/benchmarks/internal/quick-select.js index dcebaaf8..cf8f2354 100644 --- a/benchmarks/internal/quick-select.js +++ b/benchmarks/internal/quick-select.js @@ -1,45 +1,21 @@ const Benchmark = require('benchmark') -const { generateRandomInteger } = require('./benchmark-utils') +const { generateRandomInteger, LIST_FORMATTER } = require('./benchmark-utils') const suite = new Benchmark.Suite() -const LIST_FORMATTER = new Intl.ListFormat('en-US', { - style: 'long', - type: 'conjunction' -}) - -const tasksMap = new Map([ - [0, generateRandomInteger(10)], - [1, generateRandomInteger(10)], - [2, generateRandomInteger(10)], - [3, generateRandomInteger(10)], - [4, generateRandomInteger(10)], - [5, generateRandomInteger(10)], - [6, generateRandomInteger(10)], - [7, generateRandomInteger(10)], - [8, generateRandomInteger(10)], - [9, generateRandomInteger(10)], - [10, generateRandomInteger(10)], - [11, generateRandomInteger(10)], - [12, generateRandomInteger(10)], - [13, generateRandomInteger(10)], - [14, generateRandomInteger(10)], - [15, generateRandomInteger(10)], - [16, generateRandomInteger(10)], - [17, generateRandomInteger(10)], - [18, generateRandomInteger(10)], - [19, generateRandomInteger(10)], - [20, generateRandomInteger(10)], - [21, generateRandomInteger(10)], - [22, generateRandomInteger(10)], - [23, generateRandomInteger(10)], - [24, generateRandomInteger(10)], - [25, generateRandomInteger(10)], - [26, generateRandomInteger(10)], - [27, generateRandomInteger(10)], - [28, generateRandomInteger(10)], - [29, generateRandomInteger(10)] -]) +function generateRandomTasksMap ( + numberOfWorkers, + maxNumberOfTasksPerWorker = 10 +) { + const tasksArray = [] + for (let i = 0; i < numberOfWorkers; i++) { + const task = [i, generateRandomInteger(maxNumberOfTasksPerWorker)] + tasksArray.push(task) + } + return new Map(tasksArray) +} + +const tasksMap = generateRandomTasksMap(60, 20) function loopSelect (tasksMap) { let minValue = Infinity @@ -75,6 +51,10 @@ const defaultPivotIndexSelect = (leftIndex, rightIndex) => { return leftIndex + Math.floor((rightIndex - leftIndex) / 2) } +const randomPivotIndexSelect = (leftIndex, rightIndex) => { + return generateRandomInteger(leftIndex, rightIndex) +} + function swap (array, index1, index2) { const tmp = array[index1] array[index1] = array[index2] @@ -91,10 +71,10 @@ function partition ( const pivotValue = array[pivotIndex] swap(array, pivotIndex, rightIndex) let storeIndex = leftIndex - for (let i = leftIndex; i < rightIndex; i += 1) { + for (let i = leftIndex; i < rightIndex; i++) { if (compare(array[i], pivotValue)) { swap(array, storeIndex, i) - storeIndex += 1 + storeIndex++ } } swap(array, rightIndex, storeIndex) @@ -162,9 +142,7 @@ function quickSelectLoopRandomPivot (tasksMap) { (a, b) => { return a[1] < b[1] }, - (leftIndex, rightIndex) => { - return generateRandomInteger(leftIndex, rightIndex) - } + randomPivotIndexSelect ) } @@ -187,9 +165,7 @@ function quickSelectRecursionRandomPivot (tasksMap) { (a, b) => { return a[1] < b[1] }, - (leftIndex, rightIndex) => { - return generateRandomInteger(leftIndex, rightIndex) - } + randomPivotIndexSelect ) } diff --git a/benchmarks/internal/thread/fixed.js b/benchmarks/internal/thread/fixed.js index 966fc0e1..cd7fdebf 100644 --- a/benchmarks/internal/thread/fixed.js +++ b/benchmarks/internal/thread/fixed.js @@ -1,4 +1,7 @@ -const { FixedThreadPool } = require('../../../lib/index') +const { + FixedThreadPool, + WorkerChoiceStrategies +} = require('../../../lib/index') const { runPoolifierTest } = require('../benchmark-utils') const size = 30 @@ -8,10 +11,22 @@ const fixedPool = new FixedThreadPool( './benchmarks/internal/thread/worker.js' ) +const fixedPoolLessRecentlyUsed = new FixedThreadPool( + size, + './benchmarks/internal/thread/worker.js', + { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED } +) + async function fixedThreadTest ( { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } ) { return runPoolifierTest(fixedPool, { tasks, workerData }) } -module.exports = { fixedThreadTest } +async function fixedThreadTestLessRecentlyUsed ( + { tasks, workerData } = { tasks: 1, workerData: { proof: 'ok' } } +) { + return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData }) +} + +module.exports = { fixedThreadTest, fixedThreadTestLessRecentlyUsed } diff --git a/benchmarks/versus-external-pools/BENCH-100000.MD b/benchmarks/versus-external-pools/BENCH-100000.md similarity index 100% rename from benchmarks/versus-external-pools/BENCH-100000.MD rename to benchmarks/versus-external-pools/BENCH-100000.md diff --git a/benchmarks/versus-external-pools/package-lock.json b/benchmarks/versus-external-pools/package-lock.json index e3ba4c98..e05eac1c 100644 --- a/benchmarks/versus-external-pools/package-lock.json +++ b/benchmarks/versus-external-pools/package-lock.json @@ -22,15 +22,6 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, - "benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", - "requires": { - "lodash": "^4.17.4", - "platform": "^1.3.3" - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -55,6 +46,15 @@ "resolved": "https://registry.npmjs.org/eventemitter-asyncresource/-/eventemitter-asyncresource-1.0.0.tgz", "integrity": "sha512-39F7TBIV0G7gTelxwbEqnwhp90eqCPON1k0NwNfwhgKn4Co4ybUbj2pECcXT0B3ztRKZ7Pw1JujUUgmQJHcVAQ==" }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, "hdr-histogram-js": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/hdr-histogram-js/-/hdr-histogram-js-2.0.1.tgz", @@ -78,10 +78,13 @@ "symbol-observable": "^1.1.0" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "requires": { + "p-locate": "^5.0.0" + } }, "microjob": { "version": "0.7.0", @@ -133,11 +136,32 @@ "wrappy": "1" } }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "requires": { + "p-limit": "^3.0.2" + } + }, "pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, "piscina": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/piscina/-/piscina-2.2.0.tgz", @@ -149,10 +173,13 @@ "nice-napi": "^1.0.2" } }, - "platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" + "pkg-dir": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", + "requires": { + "find-up": "^5.0.0" + } }, "poolifier": { "version": "2.0.0", @@ -176,6 +203,15 @@ "tiny-worker": ">= 2" } }, + "threadwork": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/threadwork/-/threadwork-0.6.0.tgz", + "integrity": "sha512-NzKDArTtcSAq0jlMdiC04+fuls5nWn1ziptmMTBwPyjKxZk+aQvw/LVVf3IW3tUKz4vLGJ2XE+PXDMoJuoNEfQ==", + "requires": { + "callsites": "^3.1.0", + "pkg-dir": "^5.0.0" + } + }, "tiny-worker": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tiny-worker/-/tiny-worker-2.3.0.tgz", @@ -202,6 +238,11 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" } } } diff --git a/benchmarks/versus-external-pools/package.json b/benchmarks/versus-external-pools/package.json index 8e4eb770..1f5d1735 100644 --- a/benchmarks/versus-external-pools/package.json +++ b/benchmarks/versus-external-pools/package.json @@ -9,12 +9,12 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "benchmark": "^2.1.4", "microjob": "0.7.0", "node-worker-threads-pool": "1.4.3", "piscina": "2.2.0", "poolifier": "2.0.0", "threads": "1.6.3", + "threadwork": "0.6.0", "worker-threads-pool": "2.0.0", "workerpool": "6.1.0" } diff --git a/examples/dynamicExample.js b/examples/dynamicExample.js index 95b4f49a..94c665a6 100644 --- a/examples/dynamicExample.js +++ b/examples/dynamicExample.js @@ -9,7 +9,7 @@ pool.emitter.on('busy', () => maxReached++) const start = Date.now() const iterations = 1000 -for (let i = 0; i <= iterations; i++) { +for (let i = 1; i <= iterations; i++) { pool .execute({}) .then(res => { diff --git a/examples/staticExample.js b/examples/fixedExample.js similarity index 92% rename from examples/staticExample.js rename to examples/fixedExample.js index d81e3484..07a57c3e 100644 --- a/examples/staticExample.js +++ b/examples/fixedExample.js @@ -7,7 +7,7 @@ const pool = new FixedThreadPool(15, './yourWorker.js', { const start = Date.now() const iterations = 1000 -for (let i = 0; i <= iterations; i++) { +for (let i = 1; i <= iterations; i++) { pool .execute({}) .then(res => { diff --git a/package-lock.json b/package-lock.json index 7314ed17..34a18d4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,23 +20,23 @@ } }, "@babel/compat-data": { - "version": "7.13.6", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.13.6.tgz", - "integrity": "sha512-VhgqKOWYVm7lQXlvbJnWOzwfAQATd2nV52koT0HZ/LdDH0m4DUDwkKYsH+IwpXb+bKPyBJzawA4I6nBKqZcpQw==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.13.8.tgz", + "integrity": "sha512-EaI33z19T4qN3xLXsGf48M2cDqa6ei9tPZlfLdb2HC+e/cFtREiRd8hdSqDbwdLB0/+gLwqJmCYASH0z2bUdog==", "dev": true }, "@babel/core": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.13.1.tgz", - "integrity": "sha512-FzeKfFBG2rmFtGiiMdXZPFt/5R5DXubVi82uYhjGX4Msf+pgYQMCFIqFXZWs5vbIYbf14VeBIgdGI03CDOOM1w==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.13.8.tgz", + "integrity": "sha512-oYapIySGw1zGhEFRd6lzWNLWFX2s5dA/jm+Pw/+59ZdXtjyIuwlXbrId22Md0rgZVop+aVoqow2riXhBLNyuQg==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", "@babel/generator": "^7.13.0", - "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-compilation-targets": "^7.13.8", "@babel/helper-module-transforms": "^7.13.0", "@babel/helpers": "^7.13.0", - "@babel/parser": "^7.13.0", + "@babel/parser": "^7.13.4", "@babel/template": "^7.12.13", "@babel/traverse": "^7.13.0", "@babel/types": "^7.13.0", @@ -45,7 +45,7 @@ "gensync": "^1.0.0-beta.2", "json5": "^2.1.2", "lodash": "^4.17.19", - "semver": "7.0.0", + "semver": "^6.3.0", "source-map": "^0.5.0" }, "dependencies": { @@ -59,9 +59,9 @@ } }, "@babel/parser": { - "version": "7.13.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.4.tgz", - "integrity": "sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.9.tgz", + "integrity": "sha512-nEUfRiARCcaVo3ny3ZQjURjHQZUo/JkEw7rLlSZy/psWGnvwXFtPcr6jb7Yb41DVW5LTe6KRq9LGleRNsg1Frw==", "dev": true }, "json5": { @@ -74,9 +74,9 @@ } }, "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, "source-map": { @@ -88,9 +88,9 @@ } }, "@babel/generator": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.13.0.tgz", - "integrity": "sha512-zBZfgvBB/ywjx0Rgc2+BwoH/3H+lDtlgD4hBOpEv5LxRnYsm/753iRuLepqnYlynpjC3AdQxtxsoeHJoEEwOAw==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.13.9.tgz", + "integrity": "sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw==", "dev": true, "requires": { "@babel/types": "^7.13.0", @@ -107,21 +107,21 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.0.tgz", - "integrity": "sha512-SOWD0JK9+MMIhTQiUVd4ng8f3NXhPVQvTv7D3UN4wbp/6cAHnB2EmMaU1zZA2Hh1gwme+THBrVSqTFxHczTh0Q==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.8.tgz", + "integrity": "sha512-pBljUGC1y3xKLn1nrx2eAhurLMA8OqBtBP/JwG4U8skN7kf8/aqwwxpV1N6T0e7r6+7uNitIa/fUxPFagSXp3A==", "dev": true, "requires": { - "@babel/compat-data": "^7.13.0", + "@babel/compat-data": "^7.13.8", "@babel/helper-validator-option": "^7.12.17", "browserslist": "^4.14.5", - "semver": "7.0.0" + "semver": "^6.3.0" }, "dependencies": { "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true } } @@ -244,9 +244,9 @@ } }, "@babel/highlight": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.12.13.tgz", - "integrity": "sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww==", + "version": "7.13.8", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.8.tgz", + "integrity": "sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", @@ -294,9 +294,9 @@ } }, "@babel/parser": { - "version": "7.13.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.4.tgz", - "integrity": "sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.9.tgz", + "integrity": "sha512-nEUfRiARCcaVo3ny3ZQjURjHQZUo/JkEw7rLlSZy/psWGnvwXFtPcr6jb7Yb41DVW5LTe6KRq9LGleRNsg1Frw==", "dev": true } } @@ -328,9 +328,9 @@ } }, "@babel/parser": { - "version": "7.13.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.4.tgz", - "integrity": "sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA==", + "version": "7.13.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.9.tgz", + "integrity": "sha512-nEUfRiARCcaVo3ny3ZQjURjHQZUo/JkEw7rLlSZy/psWGnvwXFtPcr6jb7Yb41DVW5LTe6KRq9LGleRNsg1Frw==", "dev": true }, "globals": { @@ -995,9 +995,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001191", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001191.tgz", - "integrity": "sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw==", + "version": "1.0.30001196", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001196.tgz", + "integrity": "sha512-CPvObjD3ovWrNBaXlAIGWmg2gQQuJ5YhuciUOjPRox6hIQttu8O+b51dx6VIpIY9ESd2d0Vac1RKpICdG4rGUg==", "dev": true }, "chalk": { @@ -1151,9 +1151,9 @@ "dev": true }, "colorette": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", - "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", "dev": true }, "colors": { @@ -1419,9 +1419,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.673", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.673.tgz", - "integrity": "sha512-ms+QR2ckfrrpEAjXweLx6kNCbpAl66DcW//3BZD4BV5KhUgr0RZRce1ON/9J3QyA3JO28nzgb5Xv8DnPr05ILg==", + "version": "1.3.682", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.682.tgz", + "integrity": "sha512-zok2y37qR00U14uM6qBz/3iIjWHom2eRfC2S1StA0RslP7x34jX+j4mxv80t8OEOHLJPVG54ZPeaFxEI7gPrwg==", "dev": true }, "emoji-regex": { @@ -1449,25 +1449,27 @@ } }, "es-abstract": { - "version": "1.18.0-next.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz", - "integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2", + "get-intrinsic": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.1", + "is-regex": "^1.1.2", + "is-string": "^1.0.5", "object-inspect": "^1.9.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.3", - "string.prototype.trimstart": "^1.0.3" + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.0" } }, "es-to-primitive": { @@ -2201,9 +2203,9 @@ } }, "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "requires": { "is-glob": "^4.0.1" @@ -2272,6 +2274,12 @@ "function-bind": "^1.1.1" } }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2279,9 +2287,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, "hasha": { @@ -2420,6 +2428,12 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-bigint": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", + "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", + "dev": true + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -2429,6 +2443,15 @@ "binary-extensions": "^2.0.0" } }, + "is-boolean-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz", + "integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==", + "dev": true, + "requires": { + "call-bind": "^1.0.0" + } + }, "is-buffer": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", @@ -2501,6 +2524,12 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-number-object": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", + "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", + "dev": true + }, "is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", @@ -3907,6 +3936,17 @@ "is-core-module": "^2.1.0", "path-parse": "^1.0.6" } + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } } } }, @@ -4483,9 +4523,9 @@ "dev": true }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "dev": true, "requires": { "emoji-regex": "^8.0.0", @@ -4556,9 +4596,9 @@ }, "dependencies": { "ajv": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.1.1.tgz", - "integrity": "sha512-ga/aqDYnUy/o7vbsRTFhhTsNeXiYb5JWDIcRIeZfwRNCefwjNTVYCGdGSUrEmiu3yDK3vFvNbgJxvrQW4JXrYQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.0.tgz", + "integrity": "sha512-51Na3IUg3uOACsQ7hzTUCjSzGy8xROySgI8tmNJ+y9JF2hfDS6qkTP7+Ep3htUtSQG1t17QMbe+jZFTlaU4dDQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -4757,12 +4797,24 @@ "dev": true }, "uglify-js": { - "version": "3.12.8", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz", - "integrity": "sha512-fvBeuXOsvqjecUtF/l1dwsrrf5y2BCUk9AOJGzGcm6tE7vegku5u/YvqjyDaAGr422PLoLnrxg3EnRvTqsdC1w==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.0.tgz", + "integrity": "sha512-TWYSWa9T2pPN4DIJYbU9oAjQx+5qdV5RUDxwARg8fmJZrD/V27Zj0JngW5xg1DFz42G0uDYl2XhzF6alSzD62w==", "dev": true, "optional": true }, + "unbox-primitive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", + "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.0", + "has-symbols": "^1.0.0", + "which-boxed-primitive": "^1.0.1" + } + }, "unherit": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", @@ -4866,9 +4918,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", - "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, "validate-npm-package-license": { @@ -4954,6 +5006,19 @@ "isexe": "^2.0.0" } }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index 03a5db7e..4eccde68 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -56,11 +56,14 @@ describe('Abstract pool test suite', () => { }) it('Verify that filePath is checked', () => { + const expectedError = new Error( + 'Please specify a file with a worker implementation' + ) expect(() => new FixedThreadPool(numberOfWorkers)).toThrowError( - new Error('Please specify a file with a worker implementation') + expectedError ) expect(() => new FixedThreadPool(numberOfWorkers, '')).toThrowError( - new Error('Please specify a file with a worker implementation') + expectedError ) }) diff --git a/tests/pools/cluster/dynamic.test.js b/tests/pools/cluster/dynamic.test.js index 54d53b11..9e610d65 100644 --- a/tests/pools/cluster/dynamic.test.js +++ b/tests/pools/cluster/dynamic.test.js @@ -78,7 +78,12 @@ describe('Dynamic cluster pool test suite', () => { const longRunningPool = new DynamicClusterPool( min, max, - './tests/worker-files/cluster/longRunningWorkerHardBehavior.js' + './tests/worker-files/cluster/longRunningWorkerHardBehavior.js', + { + errorHandler: e => console.error(e), + onlineHandler: () => console.log('long running worker is online'), + exitHandler: () => console.log('long running worker exited') + } ) expect(longRunningPool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { @@ -96,7 +101,12 @@ describe('Dynamic cluster pool test suite', () => { const longRunningPool = new DynamicClusterPool( min, max, - './tests/worker-files/cluster/longRunningWorkerSoftBehavior.js' + './tests/worker-files/cluster/longRunningWorkerSoftBehavior.js', + { + errorHandler: e => console.error(e), + onlineHandler: () => console.log('long running worker is online'), + exitHandler: () => console.log('long running worker exited') + } ) expect(longRunningPool.workers.length).toBe(min) for (let i = 0; i < max * 10; i++) { diff --git a/tests/pools/cluster/fixed.test.js b/tests/pools/cluster/fixed.test.js index c69b72d8..04467620 100644 --- a/tests/pools/cluster/fixed.test.js +++ b/tests/pools/cluster/fixed.test.js @@ -29,7 +29,7 @@ const asyncErrorPool = new FixedClusterPool( 1, './tests/worker-files/cluster/asyncErrorWorker.js', { - onlineHandler: () => console.log('worker is online') + errorHandler: e => console.error(e) } ) const asyncPool = new FixedClusterPool( diff --git a/tests/pools/thread/dynamic.test.js b/tests/pools/thread/dynamic.test.js index 4e7df229..31d64727 100644 --- a/tests/pools/thread/dynamic.test.js +++ b/tests/pools/thread/dynamic.test.js @@ -84,7 +84,8 @@ describe('Dynamic thread pool test suite', () => { './tests/worker-files/thread/longRunningWorkerHardBehavior.js', { errorHandler: e => console.error(e), - onlineHandler: () => console.log('worker is online') + onlineHandler: () => console.log('long running worker is online'), + exitHandler: () => console.log('long running worker exited') } ) expect(longRunningPool.workers.length).toBe(min) @@ -105,7 +106,8 @@ describe('Dynamic thread pool test suite', () => { './tests/worker-files/thread/longRunningWorkerSoftBehavior.js', { errorHandler: e => console.error(e), - onlineHandler: () => console.log('worker is online') + onlineHandler: () => console.log('long running worker is online'), + exitHandler: () => console.log('long running worker exited') } ) expect(longRunningPool.workers.length).toBe(min) diff --git a/tests/pools/thread/fixed.test.js b/tests/pools/thread/fixed.test.js index 3401fde3..09a58e2d 100644 --- a/tests/pools/thread/fixed.test.js +++ b/tests/pools/thread/fixed.test.js @@ -22,16 +22,14 @@ const errorPool = new FixedThreadPool( 1, './tests/worker-files/thread/errorWorker.js', { - errorHandler: e => console.error(e), - onlineHandler: () => console.log('worker is online') + errorHandler: e => console.error(e) } ) const asyncErrorPool = new FixedThreadPool( 1, './tests/worker-files/thread/asyncErrorWorker.js', { - errorHandler: e => console.error(e), - onlineHandler: () => console.log('worker is online') + errorHandler: e => console.error(e) } ) const asyncPool = new FixedThreadPool( diff --git a/tests/worker/abstract-worker.test.js b/tests/worker/abstract-worker.test.js index 1d0c03d9..a22d1c9f 100644 --- a/tests/worker/abstract-worker.test.js +++ b/tests/worker/abstract-worker.test.js @@ -15,7 +15,7 @@ describe('Abstract worker test suite', () => { ) }) - it('Verify that handle Error function is working properly', () => { + it('Verify that handleError function is working properly', () => { const error = new Error('My error') const worker = new ThreadWorker(() => {}) expect(worker.handleError(error)).toBe(error) @@ -24,6 +24,6 @@ describe('Abstract worker test suite', () => { it('Verify that get main worker throw error if main worker is not set', () => { expect(() => new StubPoolWithIsMainWorker(() => {}).getMainWorker() - ).toThrowError() + ).toThrowError(new Error('Main worker was not set')) }) }) -- 2.34.1