Benchmarks and tests code cleanups. (#257)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 7 Mar 2021 18:28:25 +0000 (19:28 +0100)
committerGitHub <noreply@github.com>
Sun, 7 Mar 2021 18:28:25 +0000 (19:28 +0100)
Co-authored-by: Shinigami <chrissi92@hotmail.de>
18 files changed:
benchmarks/internal/bench.js
benchmarks/internal/benchmark-utils.js
benchmarks/internal/choose-worker.js
benchmarks/internal/cluster/fixed.js
benchmarks/internal/quick-select.js
benchmarks/internal/thread/fixed.js
benchmarks/versus-external-pools/BENCH-100000.md [moved from benchmarks/versus-external-pools/BENCH-100000.MD with 100% similarity]
benchmarks/versus-external-pools/package-lock.json
benchmarks/versus-external-pools/package.json
examples/dynamicExample.js
examples/fixedExample.js [moved from examples/staticExample.js with 92% similarity]
package-lock.json
tests/pools/abstract/abstract-pool.test.js
tests/pools/cluster/dynamic.test.js
tests/pools/cluster/fixed.test.js
tests/pools/thread/dynamic.test.js
tests/pools/thread/fixed.test.js
tests/worker/abstract-worker.test.js

index c3db71651a1e84b333490ded1bcd10f29650ff41..bdb2f614a780e0f78f86b4ff2a2063c65ce283b7 100644 (file)
@@ -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 })
 }
index cbf69307cdad7e5b07f5b8998099700ffafba2f7..878c2cae4b34bcd77e8c24cc96c96b109c290c43 100644 (file)
@@ -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 }
index 92eadfe4bd4bacced81ffa3af45faced420e3e88..e4e727a225c781e8aad777f0a3b7d97ddf8f49a3 100644 (file)
@@ -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
 
index 62c19aabf87fad362973abff99f2f390a8015712..ea61c7fcb398a40326a19f0935b7f13268050cde 100644 (file)
@@ -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 }
index dcebaaf81e3f65e103533c808a9e4266ce77e117..cf8f23540d31add705554d9ccb71ac4b3339e0ca 100644 (file)
@@ -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
   )
 }
 
index 966fc0e19ce42bae944a3ea8a4f2484e64870dc1..cd7fdebfdceeb57881be02299447ef3d3533f89d 100644 (file)
@@ -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 }
index e3ba4c98f7ccd53226e6a1d0597af5950cb91999..e05eac1ce9d5cd0d8922346b0b8d6de66fd60b5f 100644 (file)
       "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",
       "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",
         "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",
         "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",
         "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",
         "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",
       "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=="
     }
   }
 }
index 8e4eb770092edbb4ae087ebe39d35748c21efc18..1f5d1735d6d1f7898c94cce9f9ec7ce0a269c0b4 100644 (file)
@@ -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"
   }
index 95b4f49a5db650ee91642e0119f6e4b3c4359e3f..94c665a6ae88ee55e15575ff72fbcfd176751842 100644 (file)
@@ -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 => {
similarity index 92%
rename from examples/staticExample.js
rename to examples/fixedExample.js
index d81e3484e89946374cc3056208e4d888a0162722..07a57c3ef9c5fc9ff455586498294149bf14ebdb 100644 (file)
@@ -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 => {
index 7314ed177046d2ccbb2a413268437ebe155d002b..34a18d4b3e69977006fceb1c78d00706e91afb02 100644 (file)
       }
     },
     "@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",
       }
     },
     "@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
         }
       }
       }
     },
     "@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",
           }
         },
         "@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
         }
       }
           }
         },
         "@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": {
       "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": {
       "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": {
       "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": {
       }
     },
     "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": {
       }
     },
     "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"
         "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",
       "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": {
       "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",
         "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",
       "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",
             "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"
+          }
         }
       }
     },
       "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",
       },
       "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",
       "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",
       "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": {
         "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",
index 03a5db7eac5eef8ef5464907892bb27aecbb0442..4eccde68f94faa99fab805426679bdc4f916e952 100644 (file)
@@ -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
     )
   })
 
index 54d53b11a8b60931a39756d614ece9621de88cc9..9e610d65ace3ab0f8e38b734cfeadfd38a4dffa2 100644 (file)
@@ -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++) {
index c69b72d8370666f0b1f907e2c26e1e784e784c93..04467620f7d50c61b8813af25ecd011b6d145e8e 100644 (file)
@@ -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(
index 4e7df2297fee8902d4a2331ef33baba84b24dcc4..31d64727707d3bc4c31b14501fbe4b41e81aa2fb 100644 (file)
@@ -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)
index 3401fde316130e4330f111fb0c421e2ad4833d4f..09a58e2df5cafd27569842ae945373ea1a5b017f 100644 (file)
@@ -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(
index 1d0c03d9c398c75a5c88b21cb8a7ff1cb0dfc2c1..a22d1c9ff0bc8b2db5ca58ca2e634ed1cade7c62 100644 (file)
@@ -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'))
   })
 })