1'use strict'; 2 3require('../common'); 4 5const { TextEncoderStream, TextDecoderStream } = require('stream/web'); 6const util = require('util'); 7const assert = require('assert'); 8 9const textEncoderStream = new TextEncoderStream(); 10assert.strictEqual( 11 util.inspect(textEncoderStream), 12 `TextEncoderStream { 13 encoding: 'utf-8', 14 readable: ReadableStream { locked: false, state: 'readable', supportsBYOB: false }, 15 writable: WritableStream { locked: false, state: 'writable' } 16}` 17); 18assert.throws(() => textEncoderStream[util.inspect.custom].call(), { 19 code: 'ERR_INVALID_THIS', 20}); 21 22const textDecoderStream = new TextDecoderStream(); 23assert.strictEqual( 24 util.inspect(textDecoderStream), 25 `TextDecoderStream { 26 encoding: 'utf-8', 27 fatal: false, 28 ignoreBOM: false, 29 readable: ReadableStream { locked: false, state: 'readable', supportsBYOB: false }, 30 writable: WritableStream { locked: false, state: 'writable' } 31}` 32); 33assert.throws(() => textDecoderStream[util.inspect.custom].call(), { 34 code: 'ERR_INVALID_THIS', 35}); 36