Files
fx_cast/test/messageProxy.js
2019-01-12 06:31:02 +00:00

34 lines
651 B
JavaScript

"use strict";
// Create socket connection
const socket = new WebSocket("ws://localhost:8080");
window.sendMessage = (message) => {
socket.send(JSON.stringify(message));
}
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
});
}
}
socket.addEventListener("open", ev => {
jasmine.getEnv().addReporter(customReporter);
});