summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-stdout-flush.js
diff options
context:
space:
mode:
authorWietse Venema <wvenema@xebia.com>2016-09-17 10:40:10 +0200
committerJames M Snell <jasnell@gmail.com>2016-09-20 15:28:09 -0700
commit57a5136e961877d64557093685bb8fbd2926297c (patch)
tree8b06783c363b37caf9bba515a1c701ff2d4a06bc /test/parallel/test-child-process-stdout-flush.js
parent2b5acda7a297c785e3578b5dc0e4ee1743f38bd7 (diff)
downloadandroid-node-v8-57a5136e961877d64557093685bb8fbd2926297c.tar.gz
android-node-v8-57a5136e961877d64557093685bb8fbd2926297c.tar.bz2
android-node-v8-57a5136e961877d64557093685bb8fbd2926297c.zip
test: improve test-child-process-stdout-flush
Changed vars to const / let, functions to arrow functions and a mustCall where appropriate. PR-URL: https://github.com/nodejs/node/pull/8581 Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
Diffstat (limited to 'test/parallel/test-child-process-stdout-flush.js')
-rw-r--r--test/parallel/test-child-process-stdout-flush.js33
1 files changed, 15 insertions, 18 deletions
diff --git a/test/parallel/test-child-process-stdout-flush.js b/test/parallel/test-child-process-stdout-flush.js
index 8300f4bbc7..cec3ccdebf 100644
--- a/test/parallel/test-child-process-stdout-flush.js
+++ b/test/parallel/test-child-process-stdout-flush.js
@@ -1,29 +1,26 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-var path = require('path');
-var spawn = require('child_process').spawn;
-var sub = path.join(common.fixturesDir, 'print-chars.js');
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const spawn = require('child_process').spawn;
+const sub = path.join(common.fixturesDir, 'print-chars.js');
-var n = 500000;
+const n = 500000;
-var child = spawn(process.argv[0], [sub, n]);
+const child = spawn(process.argv[0], [sub, n]);
-var count = 0;
+let count = 0;
child.stderr.setEncoding('utf8');
-child.stderr.on('data', function(data) {
- console.log('parent stderr: ' + data);
- assert.ok(false);
-});
+child.stderr.on('data', common.fail);
child.stdout.setEncoding('utf8');
-child.stdout.on('data', function(data) {
+child.stdout.on('data', (data) => {
count += data.length;
- console.log(count);
});
-child.on('close', function(data) {
- assert.equal(n, count);
- console.log('okay');
-});
+child.on('close', common.mustCall((code, signal) => {
+ assert.strictEqual(code, 0);
+ assert.strictEqual(signal, null);
+ assert.strictEqual(n, count);
+}));