mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
PR-URL: https://github.com/nodejs/node/pull/60150 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
21 lines
522 B
JavaScript
21 lines
522 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { Readable, finished } = require('stream');
|
|
const { AsyncLocalStorage } = require('async_hooks');
|
|
const assert = require('assert');
|
|
|
|
// This test verifies that AsyncLocalStorage context is maintained
|
|
// when using stream.finished()
|
|
|
|
const readable = new Readable();
|
|
const als = new AsyncLocalStorage();
|
|
|
|
als.run(321, common.mustCall(() => {
|
|
finished(readable, common.mustCall(() => {
|
|
assert.strictEqual(als.getStore(), 321);
|
|
}));
|
|
}));
|
|
|
|
readable.destroy();
|