test: use arrow function

In `test/parallel/test-child-process-env.js`, callbacks use
anonymous closure functions. It is safe to replace them with arrow
functions since these callbacks don't contain references to `this`,
`super` or `arguments`. This results in shorter functions.

PR-URL: https://github.com/nodejs/node/pull/24482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
sagirk 2018-11-19 15:11:13 +05:30 committed by Gireesh Punathil
parent b02cac5b09
commit 484ad3b103

View File

@ -48,12 +48,12 @@ let response = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(chunk) {
child.stdout.on('data', (chunk) => {
console.log(`stdout: ${chunk}`);
response += chunk;
});
process.on('exit', function() {
process.on('exit', () => {
assert.ok(response.includes('HELLO=WORLD'));
assert.ok(response.includes('FOO=BAR'));
assert.ok(!response.includes('UNDEFINED=undefined'));