stream-chain icon indicating copy to clipboard operation
stream-chain copied to clipboard

Chain.on('finish', () => ...) no longer being called in `stream-chain` V3

Open ThomasShih opened this issue 10 months ago • 0 comments

We tried to bump our stream-chain from 2.2.5 to 3.4.0 but encountered an error where the .on('finish', () => ... never gets called anymore.

A min recreation as follows:

Code (using jest):

import { Readable } from 'stream';
import { chain } from 'stream-chain';

it('should recreate', async () => {
  const pipelinePromise = new Promise((resolve) => {
    const pipeline = chain([Readable.from([2]), (x: number) => x * x]);
    pipeline.on('finish', () => {
      console.error('finish');
      resolve(undefined);
    });
  });
  await pipelinePromise;
});

V2.2.5: Console logs the error message V3.4.0: Test timeout

Not sure the next steps, this is a confusing bit as the 3.4.0 type still list 'finish' as a valid option.

ThomasShih avatar Feb 24 '25 14:02 ThomasShih