MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/parallel/test-fs-stream-destroy-emit-error.js:35–43  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

33
34
35function test(stream) {
36 const err = new Error('DESTROYED');
37 stream.on('open', function() {
38 stream.destroy(err);
39 });
40 stream.on('error', common.mustCall(function(err_) {
41 assert.strictEqual(err_, err);
42 }));
43}

Calls 2

onMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected