mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 00:06:17 -04:00
Convert test runner to headless
This commit is contained in:
parent
04df7a51d2
commit
3a90244af0
14 changed files with 1466 additions and 318 deletions
38
test/TestRunner.js
Normal file
38
test/TestRunner.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* TestRunner.js
|
||||
*
|
||||
* This is for actually running the tests in the test register.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*
|
||||
*/
|
||||
(function() {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
TestRegister.runTests()
|
||||
.then(function(results) {
|
||||
results.forEach(function(testResult) {
|
||||
if (typeof window.callPhantom === "function") {
|
||||
window.callPhantom(
|
||||
"testResult",
|
||||
testResult
|
||||
);
|
||||
} else {
|
||||
var output = [
|
||||
"----------",
|
||||
testResult.test.name,
|
||||
testResult.status,
|
||||
testResult.output,
|
||||
].join("<br>");
|
||||
document.body.innerHTML += "<div>" + output + "</div>";
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof window.callPhantom === "function") {
|
||||
window.callPhantom("exit");
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue