Proxy Jasmine output to terminal

This commit is contained in:
hensm
2019-01-12 02:18:21 +00:00
parent 242142313b
commit 8f6770e8a0
6 changed files with 319 additions and 39 deletions

29
test/reporterProxy.js Normal file
View File

@@ -0,0 +1,29 @@
function sendMessage (message) {
const msgElement = document.createElement("div");
msgElement.setAttribute("id", "__msg");
msgElement.textContent = JSON.stringify(message);
document.body.appendChild(msgElement);
}
const reporterMethods = [
"jasmineDone"
, "jasmineStarted"
, "specDone"
, "specStarted"
, "suiteDone"
, "suiteStarted"
];
const customReporter = {};
// Populate reporter methods
for (const method of reporterMethods) {
customReporter[method] = function (result) {
sendMessage({
subject: method
, data: result
});
}
}
jasmine.getEnv().addReporter(customReporter);