fix: conditionally log non-assertion errors (JS)

console.logs and errors are only reported during the first evaluation of
the user's code.  This is because the code is evaluated for each test,
but the logs will not change between the build phases of the tests.

Errors thrown during testing (except failing assertions) are always
reported. This is to inform the user that their code is faulty, rather
than that it does not meet the challenge's requirements.
This commit is contained in:
Oliver Eyton-Williams
2019-11-04 12:42:19 +01:00
committed by mrugesh
parent 9a97d639f5
commit 04d2de96df
3 changed files with 41 additions and 17 deletions

View File

@@ -99,9 +99,9 @@ function getJSTestRunner({ build, sources }, proxyLogger) {
const testWorker = createWorker(testEvaluator, { terminateWorker: true });
return (testString, testTimeout) => {
return (testString, testTimeout, firstTest = true) => {
return testWorker
.execute({ build, testString, code, sources }, testTimeout)
.execute({ build, testString, code, sources, firstTest }, testTimeout)
.on('LOG', proxyLogger).done;
};
}