node/test/parallel/test-stream-pipeline-uncaught.js
Michaël Zasso bf31d3c3b1
tools: enable no-unused-expressions lint rule
Fixes: https://github.com/nodejs/node/issues/36246

PR-URL: https://github.com/nodejs/node/pull/36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-07 20:33:45 +01:00

23 lines
569 B
JavaScript

'use strict';
const common = require('../common');
const {
pipeline,
PassThrough
} = require('stream');
const assert = require('assert');
process.on('uncaughtException', common.mustCall((err) => {
assert.strictEqual(err.message, 'error');
}));
// Ensure that pipeline that ends with Promise
// still propagates error to uncaughtException.
const s = new PassThrough();
s.end('data');
pipeline(s, async function(source) {
for await (const chunk of source) {} // eslint-disable-line no-unused-vars
}, common.mustSucceed(() => {
throw new Error('error');
}));