From 2955c8b78e77487c66a4bd9fe6283fdb32674584 Mon Sep 17 00:00:00 2001 From: Viacheslav Liakhov Date: Fri, 12 Oct 2018 10:20:32 -0700 Subject: [PATCH] test: modernize test-child-process-flush-stdio PR-URL: https://github.com/nodejs/node/pull/23504 Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Ruben Bridgewater --- test/parallel/test-child-process-flush-stdio.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-child-process-flush-stdio.js b/test/parallel/test-child-process-flush-stdio.js index a2f0bb9f71f341..a7c1ea21be22a4 100644 --- a/test/parallel/test-child-process-flush-stdio.js +++ b/test/parallel/test-child-process-flush-stdio.js @@ -9,7 +9,7 @@ const opts = { shell: common.isWindows }; const p = cp.spawn('echo', [], opts); -p.on('close', common.mustCall(function(code, signal) { +p.on('close', common.mustCall((code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); spawnWithReadable(); @@ -17,17 +17,17 @@ p.on('close', common.mustCall(function(code, signal) { p.stdout.read(); -function spawnWithReadable() { +const spawnWithReadable = () => { const buffer = []; const p = cp.spawn('echo', ['123'], opts); - p.on('close', common.mustCall(function(code, signal) { + p.on('close', common.mustCall((code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); assert.strictEqual(Buffer.concat(buffer).toString().trim(), '123'); })); - p.stdout.on('readable', function() { + p.stdout.on('readable', () => { let buf; - while (buf = this.read()) + while (buf = p.stdout.read()) buffer.push(buf); }); -} +};