diff --git a/test/parallel/test-fs-write-stream.js b/test/parallel/test-fs-write-stream.js index 6d263f450b6a4b..18374f44ebcdad 100644 --- a/test/parallel/test-fs-write-stream.js +++ b/test/parallel/test-fs-write-stream.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const path = require('path'); const fs = require('fs'); @@ -52,3 +52,17 @@ tmpdir.refresh(); }); stream.destroy(); } + +// Throws if data is not of type Buffer. +{ + const stream = fs.createWriteStream(file); + stream.on('error', common.expectsError({ + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + })); + stream.write(42, null, common.expectsError({ + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + })); + stream.destroy(); +}