test: fix test-repl timeout and tmpdir refresh

PR-URL: https://github.com/nodejs/node/pull/25425
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
Brian White 2019-01-09 17:59:17 -05:00 committed by Anto Aravinth
parent 870186d69a
commit 7b6e9aedaf

View File

@ -22,6 +22,7 @@
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');
const assert = require('assert');
const net = require('net');
const repl = require('repl');
@ -823,6 +824,8 @@ function startUnixRepl() {
resolveReplServer(replServer);
}));
tmpdir.refresh();
server.listen(common.PIPE, common.mustCall(() => {
const client = net.createConnection(common.PIPE);
@ -852,7 +855,7 @@ function event(ee, expected) {
const data = inspect(expected, { compact: false });
const msg = `The REPL did not reply as expected for:\n\n${data}`;
reject(new Error(msg));
}, 500);
}, common.platformTimeout(500));
ee.once('data', common.mustCall((...args) => {
clearTimeout(timeout);
resolve(...args);