Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-worker_thr...
[poolifier.git] / tests / worker-files / thread / testWorker.js
index ccf55b56ba92d29e3848ecf0d19d37fe39f068e9..3945589f80cb088306c278ffcd5610526a615f6a 100644 (file)
@@ -1,14 +1,15 @@
 'use strict'
-const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
-const { isMainThread } = require('worker_threads')
-const TestUtils = require('../../test-utils')
+const { ThreadWorker, KillBehaviors } = require('../../../lib')
+const { executeTaskFunction } = require('../../test-utils')
+const { TaskFunctions } = require('../../test-types')
 
 function test (data) {
-  TestUtils.jsonIntegerSerialization(50)
-  return isMainThread
+  data = data || {}
+  data.function = data.function || TaskFunctions.jsonIntegerSerialization
+  return executeTaskFunction(data)
 }
 
 module.exports = new ThreadWorker(test, {
-  maxInactiveTime: 500,
-  killBehavior: KillBehaviors.HARD
+  killBehavior: KillBehaviors.HARD,
+  maxInactiveTime: 500
 })