summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-writable-callback-twice.js
blob: 25e7579a2d4737d05378a537de725a1bf90e8cb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';
const common = require('../common');
const { Writable } = require('stream');
const stream = new Writable({
  write(chunk, enc, cb) { cb(); cb(); }
});

stream.on('error', common.expectsError({
  name: 'Error',
  message: 'Callback called multiple times',
  code: 'ERR_MULTIPLE_CALLBACK'
}));

stream.write('foo');