Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions lib/Supervisor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const chalk = require('./chalk');
const child_process = require('child_process');
const fs = require('fs');
const net = require('net');
const split = require('split');
const readline = require('readline');
const Report = require('./Report');
const XMLBuilder = require('./XMLBuilder');

Expand Down Expand Up @@ -165,15 +165,13 @@ function run(elmTestVersion, pipeFilename, report, processes, dest, watch) {

// See the long note near client.write() in worker.js for why we do this.
// It fixes a nasty bug!
var stream = socket.pipe(split());

stream.on('data', function (data) {
// In watch mode, the socket is drained which results in an extraneous
// message being sent. If we receive no data, ignore it.
if (!data) {
return;
}
// https://nodejs.org/api/readline.html#example-read-file-stream-line-by-line
var stream = readline.createInterface({
input: socket,
crlfDelay: Infinity,
});

stream.on('line', function (data) {
var response = JSON.parse(data);

switch (response.type) {
Expand All @@ -183,7 +181,7 @@ function run(elmTestVersion, pipeFilename, report, processes, dest, watch) {
// This worker found no tests remaining to run; it's finished!
finishedWorkers++;

// If all the workers have finished, print the summmary.
// If all the workers have finished, print the summary.
if (finishedWorkers === workers.length) {
socket.write(
JSON.stringify({
Expand Down Expand Up @@ -255,8 +253,12 @@ function run(elmTestVersion, pipeFilename, report, processes, dest, watch) {
});
}

var pendingException = false,
server = net.createServer(initWorker);
var pendingException = false;

// Using a named pipe to communicate is actually faster than
// using `process.send` or `worker_threads`! See:
// https://github.com/rtfeldman/node-test-runner/pull/674
var server = net.createServer(initWorker);

server.on('error', function (err) {
console.error(err.stack);
Expand Down
71 changes: 0 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@
"chokidar": "^3.5.3",
"commander": "^9.4.1",
"elm-solve-deps-wasm": "^1.0.2 || ^2.0.0",
"split": "^1.0.1",
"tinyglobby": "^0.2.10",
"which": "^2.0.2"
},
"devDependencies": {
"@eslint/js": "9.20.0",
"@types/mocha": "10.0.10",
"@types/node": "26.0.1",
"@types/split": "1.0.5",
"@types/which": "3.0.4",
"elm-review": "2.13.1",
"elm-tooling": "1.18.0",
Expand Down