fix(client): execute web workers concurrently

This commit is contained in:
Valeriy S
2019-03-14 12:08:15 +03:00
committed by mrugesh mohapatra
parent e8f5b54d63
commit 845b966bda
4 changed files with 134 additions and 91 deletions

View File

@@ -90,19 +90,12 @@ export function getTestRunner(buildData, proxyLogger, document) {
function getJSTestRunner({ build, sources }, proxyLogger) {
const code = sources && 'index' in sources ? sources['index'] : '';
const testWorker = createWorker('test-evaluator');
const testWorker = createWorker('test-evaluator', { terminateWorker: true });
return async (testString, testTimeout) => {
try {
testWorker.on('LOG', proxyLogger);
return await testWorker.execute(
{ build, testString, code, sources },
testTimeout
);
} finally {
testWorker.killWorker();
testWorker.remove('LOG', proxyLogger);
}
return (testString, testTimeout) => {
return testWorker
.execute({ build, testString, code, sources }, testTimeout)
.on('LOG', proxyLogger).done;
};
}