test: log errors in test-fs-readfile-tostring-fail

The test writes out a large file via `fs.createWriteStream()` but was
not listening for the `error` event, which the `fs` docs describe as the
reliable way to detect write errors.

PR-URL: https://github.com/nodejs/node/pull/27058
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Richard Lau 2019-04-02 08:04:16 -04:00
parent 53e0f632db
commit f85ef977e6

View File

@ -21,6 +21,8 @@ const stream = fs.createWriteStream(file, {
flags: 'a'
});
stream.on('error', (err) => { throw err; });
const size = kStringMaxLength / 200;
const a = Buffer.alloc(size, 'a');