GeezerVison is showing github.com — stream: fix util.inspect for compression/decompressionStream · nodejs/node@9686153
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/compression.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -94,7 +94,7 @@ class CompressionStream { | 94 | 94 | [kInspect](depth, options) { | 95 | 95 | if (!isCompressionStream(this)) | 96 | 96 | throw new ERR_INVALID_THIS('CompressionStream'); | 97 | | - customInspect(depth, options, 'CompressionStream', { | | 97 | + return customInspect(depth, options, 'CompressionStream', { | 98 | 98 | readable: this[kTransform].readable, | 99 | 99 | writable: this[kTransform].writable, | 100 | 100 | }); | @@ -146,7 +146,7 @@ class DecompressionStream { | 146 | 146 | [kInspect](depth, options) { | 147 | 147 | if (!isDecompressionStream(this)) | 148 | 148 | throw new ERR_INVALID_THIS('DecompressionStream'); | 149 | | - customInspect(depth, options, 'DecompressionStream', { | | 149 | + return customInspect(depth, options, 'DecompressionStream', { | 150 | 150 | readable: this[kTransform].readable, | 151 | 151 | writable: this[kTransform].writable, | 152 | 152 | }); | |
Collapse file Copy file name to clipboard +41Lines changed: 41 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// Flags: --no-warnings --expose-internals | | 2 | +'use strict'; | | 3 | + | | 4 | +require('../common'); | | 5 | + | | 6 | +const assert = require('node:assert'); | | 7 | +const { describe, it } = require('node:test'); | | 8 | +const { | | 9 | + CompressionStream, | | 10 | + DecompressionStream, | | 11 | +} = require('node:stream/web'); | | 12 | + | | 13 | +const { | | 14 | + customInspectSymbol: kInspect, | | 15 | +} = require('internal/util'); | | 16 | + | | 17 | +describe('DecompressionStream kInspect method', () => { | | 18 | + it('should return a predictable inspection string with DecompressionStream', () => { | | 19 | + const decompressionStream = new DecompressionStream('deflate'); | | 20 | + const depth = 1; | | 21 | + const options = {}; | | 22 | + const actual = decompressionStream[kInspect](depth, options); | | 23 | + | | 24 | + assert(actual.includes('DecompressionStream')); | | 25 | + assert(actual.includes('ReadableStream')); | | 26 | + assert(actual.includes('WritableStream')); | | 27 | + }); | | 28 | +}); | | 29 | + | | 30 | +describe('CompressionStream kInspect method', () => { | | 31 | + it('should return a predictable inspection string with CompressionStream', () => { | | 32 | + const compressionStream = new CompressionStream('deflate'); | | 33 | + const depth = 1; | | 34 | + const options = {}; | | 35 | + const actual = compressionStream[kInspect](depth, options); | | 36 | + | | 37 | + assert(actual.includes('CompressionStream')); | | 38 | + assert(actual.includes('ReadableStream')); | | 39 | + assert(actual.includes('WritableStream')); | | 40 | + }); | | 41 | +}); |
|