1'use strict';
2
3const common = require('../common');
4const {
5  pipeline,
6  PassThrough
7} = require('stream');
8const assert = require('assert');
9
10process.on('uncaughtException', common.mustCall((err) => {
11  assert.strictEqual(err.message, 'error');
12}));
13
14// Ensure that pipeline that ends with Promise
15// still propagates error to uncaughtException.
16const s = new PassThrough();
17s.end('data');
18pipeline(s, async function(source) {
19  for await (const chunk of source) { } // eslint-disable-line no-unused-vars, no-empty
20}, common.mustSucceed(() => {
21  throw new Error('error');
22}));
23