0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-stream-readable-invalid-chunk.js
Matteo Collina 6e86a6651c stream: complete migration to internal/errors
Complete the migration to the new error system of _stream_readable
and _stream_writable. Adds the corresponding documentation.

PR-URL: https://github.com/nodejs/node/pull/16589
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-10-29 18:57:28 +01:00

20 lines
375 B
JavaScript

'use strict';
const common = require('../common');
const stream = require('stream');
const readable = new stream.Readable({
read: () => {}
});
function checkError(fn) {
common.expectsError(fn, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError
});
}
checkError(() => readable.push([]));
checkError(() => readable.push({}));
checkError(() => readable.push(0));