test: switch thread worker to ESM
[poolifier.git] / tests / worker-files / thread / testWorker.mjs
1 import { KillBehaviors, ThreadWorker } from '../../../lib/index.js'
2 import { executeTaskFunction } from '../../test-utils.js'
3 import { TaskFunctions } from '../../test-types.js'
4
5 /**
6 *
7 * @param data
8 */
9 function test (data) {
10 data = data || {}
11 data.function = data.function || TaskFunctions.jsonIntegerSerialization
12 return executeTaskFunction(data)
13 }
14
15 export default new ThreadWorker(test, {
16 killBehavior: KillBehaviors.HARD,
17 maxInactiveTime: 500
18 })