GeezerVison is showing github.com — stream: fix util.inspect for compression/decompressionStream · nodejs/node@fa71543
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 |
|---|
@@ -78,7 +78,7 @@ class CompressionStream { | 78 | 78 | } | 79 | 79 |
| 80 | 80 | [kInspect](depth, options) { | 81 | | - customInspect(depth, options, 'CompressionStream', { | | 81 | + return customInspect(depth, options, 'CompressionStream', { | 82 | 82 | readable: this.#transform.readable, | 83 | 83 | writable: this.#transform.writable, | 84 | 84 | }); | @@ -128,7 +128,7 @@ class DecompressionStream { | 128 | 128 | } | 129 | 129 |
| 130 | 130 | [kInspect](depth, options) { | 131 | | - customInspect(depth, options, 'DecompressionStream', { | | 131 | + return customInspect(depth, options, 'DecompressionStream', { | 132 | 132 | readable: this.#transform.readable, | 133 | 133 | writable: this.#transform.writable, | 134 | 134 | }); | |
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 | +}); |
|