Source code
Revision control
Copy as Markdown
Other Tools
'use strict';
const WebSocket = require('../');
let currentTest = 1;
let testCount;
function nextTest() {
let ws;
if (currentTest > testCount) {
return;
}
console.log(`Running test case ${currentTest}/${testCount}`);
ws = new WebSocket(
);
ws.on('message', (data, isBinary) => {
ws.send(data, { binary: isBinary });
});
ws.on('close', () => {
currentTest++;
process.nextTick(nextTest);
});
ws.on('error', (e) => console.error(e));
}
ws.on('message', (data) => {
testCount = parseInt(data);
});
ws.on('close', () => {
if (testCount > 0) {
nextTest();
}
});