X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fthread%2FtestWorker.js;h=668587dbf0bb85925640d9d90e90f991efde7cbf;hb=aba955e18c656962a79c88816371be2180bbf268;hp=773e11164014a35a01e3cfc0dfe3f8f797d46336;hpb=bf9549aef8a23a3931e19040dadb7f1e8e6422b5;p=poolifier.git diff --git a/tests/worker-files/thread/testWorker.js b/tests/worker-files/thread/testWorker.js index 773e1116..668587db 100644 --- a/tests/worker-files/thread/testWorker.js +++ b/tests/worker-files/thread/testWorker.js @@ -1,11 +1,17 @@ 'use strict' -const { ThreadWorker, KillBehaviors } = require('../../../lib/index') const { isMainThread } = require('worker_threads') +const { ThreadWorker, KillBehaviors } = require('../../../lib') const TestUtils = require('../../test-utils') +const { WorkerFunctions } = require('../../test-types') function test (data) { - TestUtils.jsonIntegerSerialization(100) - return isMainThread + data = data || {} + data.function = data.function || WorkerFunctions.jsonIntegerSerialization + const result = TestUtils.executeWorkerFunction(data) + if (result == null) { + return isMainThread + } + return result } module.exports = new ThreadWorker(test, {