X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Fworker-files%2Fthread%2FasyncErrorWorker.js;h=39f4055d771d7896c3d0cdf8d490af0d8baca64f;hb=15d563152134452a245e4842b20fbf4030457e16;hp=d973f0a4d7625e826c19ad550c1f61a6f7836217;hpb=0a01b5c3aa58059e7241d4394cf3953779029507;p=poolifier.git diff --git a/tests/worker-files/thread/asyncErrorWorker.js b/tests/worker-files/thread/asyncErrorWorker.js index d973f0a4..39f4055d 100644 --- a/tests/worker-files/thread/asyncErrorWorker.js +++ b/tests/worker-files/thread/asyncErrorWorker.js @@ -1,10 +1,14 @@ 'use strict' const { ThreadWorker, KillBehaviors } = require('../../../lib/index') +const TestUtils = require('../../test-utils') async function error (data) { - return new Promise((resolve, reject) => { - setTimeout(() => reject(new Error(data)), 2000) - }) + return TestUtils.workerSleepFunction( + data, + 2000, + true, + 'Error Message from ThreadWorker:async' + ) } module.exports = new ThreadWorker(error, {