Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
fixup: parallel/intl* – net*
  • Loading branch information
vsemozhetbyt committed May 5, 2017
commit 45fac06153a4738b5208e6b606369f18c9921e99
10 changes: 4 additions & 6 deletions test/parallel/test-intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,14 @@ assert.strictEqual('ç'.toUpperCase(), 'Ç');

if (!common.hasIntl) {
const erMsg =
'"Intl" object is NOT present but v8_enable_i18n_support is ' +
enablei18n;
`"Intl" object is NOT present but v8_enable_i18n_support is ${enablei18n}`;
assert.strictEqual(enablei18n, 0, erMsg);
common.skip('Intl tests because Intl object not present.');

} else {
const erMsg =
'"Intl" object is present but v8_enable_i18n_support is ' +
enablei18n +
'. Is this test out of date?';
`"Intl" object is present but v8_enable_i18n_support is ${
enablei18n}. Is this test out of date?`;
assert.strictEqual(enablei18n, 1, erMsg);

// Construct a new date at the beginning of Unix time
Expand All @@ -77,7 +75,7 @@ if (!common.hasIntl) {
common.skip('detailed Intl tests because English is not ' +
'listed as supported.');
// Smoke test. Does it format anything, or fail?
console.log('Date(0) formatted to: ' + dtf.format(date0));
console.log(`Date(0) formatted to: ${dtf.format(date0)}`);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-module-globalpaths-nodepath.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const partC = '';
if (common.isWindows) {
partA = 'C:\\Users\\Rocko Artischocko\\AppData\\Roaming\\npm';
partB = 'C:\\Program Files (x86)\\nodejs\\';
process.env['NODE_PATH'] = partA + ';' + partB + ';' + partC;
process.env['NODE_PATH'] = `${partA};${partB};${partC}`;
} else {
partA = '/usr/test/lib/node_modules';
partB = '/usr/test/lib/node';
process.env['NODE_PATH'] = partA + ':' + partB + ':' + partC;
process.env['NODE_PATH'] = `${partA}:${partB}:${partC}`;
}

mod._initPaths();
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-module-loading-globalpaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if (process.argv[2] === 'child') {
child_process.execFileSync(testExecPath, [ __filename, 'child' ],
{ encoding: 'utf8', env: env });
},
new RegExp('Cannot find module \'' + pkgName + '\''));
new RegExp(`Cannot find module '${pkgName}'`));

// Test module in $HOME/.node_modules.
const modHomeDir = path.join(testFixturesDir, 'home-pkg-in-node_modules');
Expand All @@ -75,8 +75,8 @@ if (process.argv[2] === 'child') {
fs.mkdirSync(prefixLibPath);
const prefixLibNodePath = path.join(prefixLibPath, 'node');
fs.mkdirSync(prefixLibNodePath);
const pkgPath = path.join(prefixLibNodePath, pkgName + '.js');
fs.writeFileSync(pkgPath, 'exports.string = \'' + expectedString + '\';');
const pkgPath = path.join(prefixLibNodePath, `${pkgName}.js`);
fs.writeFileSync(pkgPath, `exports.string = '${expectedString}';`);

env['HOME'] = env['USERPROFILE'] = noPkgHomeDir;
runTest(expectedString, env);
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-module-nodemodulepaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ node-gyp/node_modules/glob/node_modules',
const platformCases = common.isWindows ? cases.WIN : cases.POSIX;
platformCases.forEach((c) => {
const paths = _module._nodeModulePaths(c.file);
assert.deepStrictEqual(c.expect, paths, 'case ' + c.file +
' failed, actual paths is ' + JSON.stringify(paths));
assert.deepStrictEqual(
c.expect, paths,
`case ${c.file} failed, actual paths is ${JSON.stringify(paths)}`);
});
4 changes: 2 additions & 2 deletions test/parallel/test-module-require-depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const internalModule = require('internal/module');

// Module one loads two too so the expected depth for two is, well, two.
assert.strictEqual(internalModule.requireDepth, 0);
const one = require(common.fixturesDir + '/module-require-depth/one');
const two = require(common.fixturesDir + '/module-require-depth/two');
const one = require(`${common.fixturesDir}/module-require-depth/one`);
const two = require(`${common.fixturesDir}/module-require-depth/two`);
assert.deepStrictEqual(one, { requireDepth: 1 });
assert.deepStrictEqual(two, { requireDepth: 2 });
assert.strictEqual(internalModule.requireDepth, 0);
2 changes: 1 addition & 1 deletion test/parallel/test-net-better-error-messages-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ c.on('connect', common.mustNotCall());

c.on('error', common.mustCall(function(e) {
assert.strictEqual(e.code, 'ENOENT');
assert.strictEqual(e.message, 'connect ENOENT ' + fp);
assert.strictEqual(e.message, `connect ENOENT ${fp}`);
}));
6 changes: 3 additions & 3 deletions test/parallel/test-net-bytes-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const tcp = net.Server(function(s) {

s.on('end', function() {
bytesRead += s.bytesRead;
console.log('tcp socket disconnect #' + count);
console.log(`tcp socket disconnect #${count}`);
});
});

Expand All @@ -61,8 +61,8 @@ tcp.listen(0, function doTest() {

socket.on('close', function() {
console.error('CLIENT close event #%d', count);
console.log('Bytes read: ' + bytesRead);
console.log('Bytes written: ' + bytesWritten);
console.log(`Bytes read: ${bytesRead}`);
console.log(`Bytes written: ${bytesWritten}`);
if (count < 2) {
console.error('RECONNECTING');
socket.connect(tcp.address().port);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-connect-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const tcp = net.Server(function(s) {
});

s.on('error', function(e) {
console.log('tcp server-side error: ' + e.message);
console.log(`tcp server-side error: ${e.message}`);
process.exit(1);
});
});
Expand All @@ -60,7 +60,7 @@ tcp.listen(0, function() {
connectHappened = true;
});

console.log('connecting = ' + socket.connecting);
console.log(`connecting = ${socket.connecting}`);

assert.strictEqual('opening', socket.readyState);

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-net-connect-options-allowhalfopen.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
console.error(`No. ${index} client received FIN`);
assert(!client.readable);
assert(client.writable);
assert(client.write(index + ''));
assert(client.write(String(index)));
client.end();
clientSentFIN++;
console.error(`No. ${index} client sent FIN, ` +
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-net-connect-options-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
})
.on('error', function(err) {
console.error(err);
assert.fail(null, null, '[Pipe server]' + err);
assert.fail(null, null, `[Pipe server]${err}`);
})
.listen({path: serverPath}, common.mustCall(function serverOnListen() {
const getSocketOpt = (index) => {
const handle = new Pipe();
const err = handle.bind(`${prefix}-client-${socketCounter++}`);
assert(err >= 0, '' + err);
assert(err >= 0, String(err));
assert.notStrictEqual(handle.fd, -1);
handleMap.set(index, handle);
console.error(`[Pipe]Bound handle with Pipe ${handle.fd}`);
Expand All @@ -90,11 +90,11 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
assert(handleMap.has(index));
const oldHandle = handleMap.get(index);
assert.strictEqual(oldHandle.fd, this._handle.fd);
client.write(oldHandle.fd + '');
client.write(String(oldHandle.fd));
console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`);
client.on('error', function(err) {
console.error(err);
assert.fail(null, null, '[Pipe Client]' + err);
assert.fail(null, null, `[Pipe Client]${err}`);
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-net-connect-options-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const net = require('net');

// Total connections = 3 * 4(canConnect) * 6(doConnect) = 72
canConnect(port);
canConnect(port + '');
canConnect('0x' + port.toString(16));
canConnect(String(port));
canConnect(`0x${port.toString(16)}`);
}));

// Try connecting to random ports, but do so once the server is closed
Expand Down Expand Up @@ -191,7 +191,7 @@ function canConnect(port) {
function asyncFailToConnect(port) {
const onError = () => common.mustCall(function(err) {
const regexp = /^Error: connect (E\w+)(.+)$/;
assert(regexp.test(err + ''), err + '');
assert(regexp.test(String(err)), String(err));
});

const dont = () => common.mustNotCall();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-net-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isLegalPort = require('internal/net').isLegalPort;

for (let n = 0; n <= 0xFFFF; n++) {
assert(isLegalPort(n));
assert(isLegalPort('' + n));
assert(isLegalPort(String(n)));
assert(`0x${n.toString(16)}`);
assert(`0o${n.toString(8)}`);
assert(`0b${n.toString(2)}`);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-listen-shared-ports.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ if (cluster.isMaster) {

server1.on('error', function(err) {
// no errors expected
process.send('server1:' + err.code);
process.send(`server1:${err.code}`);
});

server2.on('error', function(err) {
// an error is expected on the second worker
process.send('server2:' + err.code);
process.send(`server2:${err.code}`);
});

server1.listen({
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-net-pipe-connect-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (common.isWindows) {
// on CI for a POSIX socket. Even though this isn't actually a socket file,
// the error will be different from the one we are expecting if we exceed the
// limit.
emptyTxt = common.tmpDir + '0.txt';
emptyTxt = `${common.tmpDir}0.txt`;

function cleanup() {
try {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-net-reconnect-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const c = net.createConnection(common.PORT);
c.on('connect', common.mustNotCall('client should not have connected'));

c.on('error', function(e) {
console.error('CLIENT error: ' + e.code);
console.error(`CLIENT error: ${e.code}`);
client_error_count++;
assert.strictEqual('ECONNREFUSED', e.code);
});
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-reconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const server = net.createServer(function(socket) {
});

socket.on('close', function(had_error) {
console.log('SERVER had_error: ' + JSON.stringify(had_error));
console.log(`SERVER had_error: ${JSON.stringify(had_error)}`);
assert.strictEqual(false, had_error);
});
});
Expand All @@ -60,7 +60,7 @@ server.listen(0, function() {

client.on('data', function(chunk) {
client_recv_count += 1;
console.log('client_recv_count ' + client_recv_count);
console.log(`client_recv_count ${client_recv_count}`);
assert.strictEqual('hello\r\n', chunk);
console.error('CLIENT: calling end', client._writableState);
client.end();
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-server-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ process.on('exit', function() {
let expectedConnectionKey1;

if (address1.family === 'IPv6')
expectedConnectionKey1 = '6::::' + address1.port;
expectedConnectionKey1 = `6::::${address1.port}`;
else
expectedConnectionKey1 = '4:0.0.0.0:' + address1.port;
expectedConnectionKey1 = `4:0.0.0.0:${address1.port}`;

assert.strictEqual(connectionKey1, expectedConnectionKey1);
assert.strictEqual(common.PORT + 1, address2.port);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-server-listen-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let counter = 0;

// Avoid conflict with listen-path
function randomPipePath() {
return common.PIPE + '-listen-handle-' + (counter++);
return `${common.PIPE}-listen-handle-${counter++}`;
}

function randomHandle(type) {
Expand Down Expand Up @@ -146,7 +146,7 @@ if (!common.isWindows) { // Windows doesn't support {fd: <n>}
net.createServer()
.listen({fd: fd}, common.mustNotCall())
.on('error', common.mustCall(function(err) {
assert.strictEqual(err + '', 'Error: listen EINVAL');
assert.strictEqual(String(err), 'Error: listen EINVAL');
this.close();
}));
}
2 changes: 1 addition & 1 deletion test/parallel/test-net-server-listen-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let counter = 0;

// Avoid conflict with listen-handle
function randomPipePath() {
return common.PIPE + '-listen-path-' + (counter++);
return `${common.PIPE}-listen-path-${counter++}`;
}

// Test listen(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const received = [];
const sent = [];

function createConnection(index) {
console.error('creating connection ' + index);
console.error(`creating connection ${index}`);

return new Promise(function(resolve, reject) {
const connection = net.createConnection(server.address().port, function() {
const msg = '' + index;
console.error('sending message: ' + msg);
const msg = String(index);
console.error(`sending message: ${msg}`);
this.write(msg);
sent.push(msg);
});
Expand All @@ -34,12 +34,12 @@ function createConnection(index) {
});

connection.on('data', function(e) {
console.error('connection ' + index + ' received response');
console.error(`connection ${index} received response`);
resolve();
});

connection.on('end', function() {
console.error('ending ' + index);
console.error(`ending ${index}`);
resolve();
});

Expand All @@ -48,7 +48,7 @@ function createConnection(index) {
}

function closeConnection(index) {
console.error('closing connection ' + index);
console.error(`closing connection ${index}`);
return new Promise(function(resolve, reject) {
connections[index].on('end', function() {
resolve();
Expand All @@ -59,8 +59,8 @@ function closeConnection(index) {

const server = net.createServer(function(socket) {
socket.on('data', function(data) {
console.error('received message: ' + data);
received.push('' + data);
console.error(`received message: ${data}`);
received.push(String(data));
socket.write('acknowledged');
});
});
Expand Down