fix: flush logs straight after evaluation (#38011)

If test evaluation takes too long the worker can timeout and any logs
will be lost.  Flushing the logs before test evaluation avoids this.
This commit is contained in:
Oliver Eyton-Williams
2020-01-04 06:08:05 +01:00
committed by mrugesh
parent 0a0cbead58
commit e2b357bb56

View File

@ -47,7 +47,8 @@ const __utils = (() => {
return { return {
postResult, postResult,
log, log,
toggleProxyLogger toggleProxyLogger,
flushLogs
}; };
})(); })();
@ -71,6 +72,7 @@ self.onmessage = async e => {
// generated during testing. // generated during testing.
testResult = eval(` testResult = eval(`
${e.data.build} ${e.data.build}
__utils.flushLogs();
__userCodeWasExecuted = true; __userCodeWasExecuted = true;
__utils.toggleProxyLogger(true); __utils.toggleProxyLogger(true);
${e.data.testString} ${e.data.testString}