mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
36 lines
697 B
JavaScript
36 lines
697 B
JavaScript
"use strict";
|
|
|
|
// Create socket connection
|
|
const socket = new WebSocket("ws://localhost:8080");
|
|
|
|
window.messageProxy = {
|
|
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) {
|
|
messageProxy.sendMessage({
|
|
subject: method,
|
|
data: result
|
|
});
|
|
};
|
|
}
|
|
|
|
socket.addEventListener("open", ev => {
|
|
jasmine.getEnv().addReporter(customReporter);
|
|
});
|