refactor: clearer errors for curriculum tests (#62331)

This commit is contained in:
Oliver Eyton-Williams
2025-09-23 20:10:28 +02:00
committed by GitHub
parent bbe7752ef1
commit d96d528e8c

View File

@@ -329,7 +329,11 @@ seed goes here
it(
`Solution ${index + 1} must pass the tests`,
async function () {
await testRunner(tests);
try {
await testRunner(tests);
} catch (e) {
expect(e).toBeUndefined();
}
},
timePerTest * tests.length + 2000
);
@@ -385,12 +389,8 @@ async function createTestRunner(
const newMessage = solutionFromNext
? 'Check next step for solution!\n' + text
: text;
// if the stack is missing, the message should be included. Otherwise it
// is redundant.
err.message = err.stack
? newMessage
: `${newMessage}
${err.message}`;
err.message = `${newMessage}
Original message: ${err.message}`;
throw err;
}
}