mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 17:49:58 +00:00
Proxy Jasmine output to terminal
This commit is contained in:
29
test/reporterProxy.js
Normal file
29
test/reporterProxy.js
Normal 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);
|
||||
Reference in New Issue
Block a user