Files
fx_cast/test/reporterProxy.js
2019-01-12 02:20:57 +00:00

30 lines
656 B
JavaScript

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);