mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
30 lines
656 B
JavaScript
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);
|