mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Use WebSocket for message proxy
This commit is contained in:
33
test/messageProxy.js
Normal file
33
test/messageProxy.js
Normal file
@@ -0,0 +1,33 @@
|
||||
"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);
|
||||
});
|
||||
Reference in New Issue
Block a user