Skip to content

Commit

Permalink
test: update test to use a test file from test/fixtures
Browse files Browse the repository at this point in the history
The test has been updated to read a test file from the
test/fixtures folder.  This makes the source of the test
less cluttered.
  • Loading branch information
domahony committed Mar 24, 2018
1 parent 47e6411 commit cfb0cc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
5 changes: 5 additions & 0 deletions test/fixtures/readfile_pipe_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx
17 changes: 3 additions & 14 deletions test/parallel/test-fs-readfile-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if (common.isWindows || common.isAIX)
common.skip(`No /dev/stdin on ${process.platform}.`);

const assert = require('assert');
const path = require('path');
const fs = require('fs');

if (process.argv[2] === 'child') {
Expand All @@ -39,16 +38,10 @@ if (process.argv[2] === 'child') {
return;
}

const tmpdir = require('../common/tmpdir');
const fixtures = require('../common/fixtures');

const filename = path.join(tmpdir.path, '/readfile_pipe_test.txt');
const dataExpected = `xxxxxxxxxx xxxxxxxxxx
xxxxxxxxxx xxxxxxxxxx
xxxxxxxxxx xxxxxxxxxx
xxxxxxxxxx xxxxxxxxxx
xxxxxxxxxx xxxxxxxxxx`;
tmpdir.refresh();
fs.writeFileSync(filename, dataExpected);
const filename = fixtures.path('readfile_pipe_test.txt');
const dataExpected = fs.readFileSync(filename).toString();

const exec = require('child_process').exec;
const f = JSON.stringify(__filename);
Expand All @@ -66,7 +59,3 @@ exec(cmd, function(err, stdout, stderr) {
`expected not to read anything from stderr but got: '${stderr}'`);
console.log('ok');
});

process.on('exit', function() {
fs.unlinkSync(filename);
});

0 comments on commit cfb0cc3

Please sign in to comment.