test: log errors in test-fs-readfile-tostring-fail · nodejs/node@f85ef97 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Commit f85ef97

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: #27058Reviewed-By: Ruben Bridgewater ruben@bridgewater.de Reviewed-By: Colin Ihrig cjihrig@gmail.com

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ const stream = fs.createWriteStream(file, {
21 21 flags: 'a'
22 22 });
23 23
24 +stream.on('error', (err) => { throw err; });
25 +
24 26 const size = kStringMaxLength / 200;
25 27 const a = Buffer.alloc(size, 'a');
26 28