node/test/parallel/test-pipe-head.js
Amanuel Ghebreweldi a97944306f
test: assertions arguments match docs
PR-URL: https://github.com/nodejs/node/pull/23594
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-10-15 15:38:36 +02:00

18 lines
478 B
JavaScript

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const exec = require('child_process').exec;
const nodePath = process.argv[0];
const script = fixtures.path('print-10-lines.js');
const cmd = `"${nodePath}" "${script}" | head -2`;
exec(cmd, common.mustCall(function(err, stdout, stderr) {
assert.ifError(err);
const lines = stdout.split('\n');
assert.strictEqual(lines.length, 3);
}));