convert the rest of the helper files to ts

This commit is contained in:
Fred K. Schott
2019-10-15 21:12:18 -07:00
parent 7ec128c2e4
commit 39f6a51794
16 changed files with 89 additions and 112 deletions

View File

@@ -1,26 +0,0 @@
'use strict'; // eslint-disable-line
const net = require('net');
// using a free port instead of a constant port enables parallelization
function getFreePort() {
return new Promise((resolve, reject) => {
const server = net.createServer();
let port;
server.on('listening', function() {
port = server.address().port;
server.close();
});
server.on('close', function() {
resolve(port);
});
server.on('error', function(error) {
reject(error);
});
server.listen(0);
});
}
module.exports = {
getFreePort
};