repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #747 from poolifier/multiple-functions
[poolifier.git]
/
tests
/
worker-files
/
thread
/
testWorker.js
diff --git
a/tests/worker-files/thread/testWorker.js
b/tests/worker-files/thread/testWorker.js
index c70069c7269f17d2f83069554d0e3fba5d2a15e6..668587dbf0bb85925640d9d90e90f991efde7cbf 100644
(file)
--- a/
tests/worker-files/thread/testWorker.js
+++ b/
tests/worker-files/thread/testWorker.js
@@
-1,15
+1,17
@@
'use strict'
'use strict'
-const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
const { isMainThread } = require('worker_threads')
const { isMainThread } = require('worker_threads')
+const { ThreadWorker, KillBehaviors } = require('../../../lib')
+const TestUtils = require('../../test-utils')
+const { WorkerFunctions } = require('../../test-types')
function test (data) {
function test (data) {
- for (let i = 0; i <= 50; i++) {
- const o = {
- a: i
- }
- JSON.stringify(o)
+ data = data || {}
+ data.function = data.function || WorkerFunctions.jsonIntegerSerialization
+ const result = TestUtils.executeWorkerFunction(data)
+ if (result == null) {
+ return isMainThread
}
}
- return
isMainThread
+ return
result
}
module.exports = new ThreadWorker(test, {
}
module.exports = new ThreadWorker(test, {