Skip to content

Commit cfb0cc3

Browse files
committed
test: update test to use a test file from test/fixtures
The test has been updated to read a test file from the test/fixtures folder. This makes the source of the test less cluttered.
1 parent 47e6411 commit cfb0cc3

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
xxxx xxxx xxxx xxxx
2+
xxxx xxxx xxxx xxxx
3+
xxxx xxxx xxxx xxxx
4+
xxxx xxxx xxxx xxxx
5+
xxxx xxxx xxxx xxxx

test/parallel/test-fs-readfile-pipe.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ if (common.isWindows || common.isAIX)
2828
common.skip(`No /dev/stdin on ${process.platform}.`);
2929

3030
const assert = require('assert');
31-
const path = require('path');
3231
const fs = require('fs');
3332

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

42-
const tmpdir = require('../common/tmpdir');
41+
const fixtures = require('../common/fixtures');
4342

44-
const filename = path.join(tmpdir.path, '/readfile_pipe_test.txt');
45-
const dataExpected = `xxxxxxxxxx xxxxxxxxxx
46-
xxxxxxxxxx xxxxxxxxxx
47-
xxxxxxxxxx xxxxxxxxxx
48-
xxxxxxxxxx xxxxxxxxxx
49-
xxxxxxxxxx xxxxxxxxxx`;
50-
tmpdir.refresh();
51-
fs.writeFileSync(filename, dataExpected);
43+
const filename = fixtures.path('readfile_pipe_test.txt');
44+
const dataExpected = fs.readFileSync(filename).toString();
5245

5346
const exec = require('child_process').exec;
5447
const f = JSON.stringify(__filename);
@@ -66,7 +59,3 @@ exec(cmd, function(err, stdout, stderr) {
6659
`expected not to read anything from stderr but got: '${stderr}'`);
6760
console.log('ok');
6861
});
69-
70-
process.on('exit', function() {
71-
fs.unlinkSync(filename);
72-
});

0 commit comments

Comments
 (0)