Enchance benchmarking code
[poolifier.git] / tests / worker-files / thread / testWorker.js
CommitLineData
106744f7 1'use strict'
1a81f8af 2const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
106744f7 3const { isMainThread } = require('worker_threads')
cf597bc5 4const TestUtils = require('../../test-utils')
2d2e32c2 5const { WorkerFunctions } = require('../../test-types')
106744f7 6
7function test (data) {
6db75ad9
JB
8 data = data || {}
9 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
10 TestUtils.executeWorkerFunction(data)
106744f7 11 return isMainThread
12}
13
4c35177b 14module.exports = new ThreadWorker(test, {
15 maxInactiveTime: 500,
1a81f8af 16 killBehavior: KillBehaviors.HARD
4c35177b 17})