• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const { Writable } = require('stream');
5
6{
7  const w = new Writable({
8    write: common.mustCall((chunk, encoding, cb) => {
9      w.on('close', common.mustCall(() => {
10        cb();
11      }));
12    })
13  });
14
15  w.on('finish', common.mustNotCall());
16  w.end('asd');
17  w.destroy();
18}
19
20{
21  const w = new Writable({
22    write: common.mustCall((chunk, encoding, cb) => {
23      w.on('close', common.mustCall(() => {
24        cb();
25        w.end();
26      }));
27    })
28  });
29
30  w.on('finish', common.mustNotCall());
31  w.write('asd');
32  w.destroy();
33}
34
35{
36  const w = new Writable({
37    write() {
38    }
39  });
40  w.on('finish', common.mustNotCall());
41  w.end();
42  w.destroy();
43}
44