mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Tests now display a progress bar and report long running tests
This commit is contained in:
parent
75da5b650c
commit
4308c717c3
10 changed files with 196 additions and 83 deletions
|
@ -33,6 +33,10 @@ function handleTestResult(testStatus, testResult) {
|
|||
testStatus.allTestsPassing = testStatus.allTestsPassing && testResult.status === "passing";
|
||||
testStatus.counts[testResult.status] = (testStatus.counts[testResult.status] || 0) + 1;
|
||||
testStatus.counts.total += 1;
|
||||
|
||||
if (testResult.duration > 2000) {
|
||||
console.log(`'${testResult.test.name}' took ${(testResult.duration / 1000).toFixed(2)}s to complete`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,8 +46,6 @@ function handleTestResult(testStatus, testResult) {
|
|||
* @param {Object[]} results - results from TestRegister
|
||||
*/
|
||||
export function logTestReport(testStatus, results) {
|
||||
console.log("Tests completed.");
|
||||
|
||||
results.forEach(r => handleTestResult(testStatus, r));
|
||||
|
||||
console.log();
|
||||
|
@ -80,8 +82,9 @@ export function logTestReport(testStatus, results) {
|
|||
* Fail if the process takes longer than 60 seconds.
|
||||
*/
|
||||
export function setLongTestFailure() {
|
||||
const timeLimit = 60;
|
||||
setTimeout(function() {
|
||||
console.log("Tests took longer than 60 seconds to run, returning.");
|
||||
console.log(`Tests took longer than ${timeLimit} seconds to run, returning.`);
|
||||
process.exit(1);
|
||||
}, 60 * 1000);
|
||||
}, timeLimit * 1000);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue