11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst {
71cb0ef41Sopenharmony_ci  Transform,
81cb0ef41Sopenharmony_ci  Readable,
91cb0ef41Sopenharmony_ci  Writable,
101cb0ef41Sopenharmony_ci  compose
111cb0ef41Sopenharmony_ci} = require('stream');
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciconst {
141cb0ef41Sopenharmony_ci  TransformStream,
151cb0ef41Sopenharmony_ci  ReadableStream,
161cb0ef41Sopenharmony_ci  WritableStream,
171cb0ef41Sopenharmony_ci} = require('stream/web');
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci{
201cb0ef41Sopenharmony_ci  let res = '';
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci  const d = compose(
231cb0ef41Sopenharmony_ci    new TransformStream({
241cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
251cb0ef41Sopenharmony_ci        controller.enqueue(chunk?.toString()?.replace(' ', '_'));
261cb0ef41Sopenharmony_ci      })
271cb0ef41Sopenharmony_ci    }),
281cb0ef41Sopenharmony_ci    new TransformStream({
291cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
301cb0ef41Sopenharmony_ci        controller.enqueue(chunk?.toString()?.toUpperCase());
311cb0ef41Sopenharmony_ci      })
321cb0ef41Sopenharmony_ci    })
331cb0ef41Sopenharmony_ci  );
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ci  d.on('data', common.mustCall((chunk) => {
361cb0ef41Sopenharmony_ci    res += chunk;
371cb0ef41Sopenharmony_ci  }));
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci  d.on('end', common.mustCall(() => {
401cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'HELLO_WORLD');
411cb0ef41Sopenharmony_ci  }));
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci  d.end('hello world');
441cb0ef41Sopenharmony_ci}
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci{
471cb0ef41Sopenharmony_ci  let res = '';
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci  compose(
501cb0ef41Sopenharmony_ci    new Transform({
511cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, encoding, callback) => {
521cb0ef41Sopenharmony_ci        callback(null, chunk + chunk);
531cb0ef41Sopenharmony_ci      })
541cb0ef41Sopenharmony_ci    }),
551cb0ef41Sopenharmony_ci    new TransformStream({
561cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
571cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
581cb0ef41Sopenharmony_ci      })
591cb0ef41Sopenharmony_ci    })
601cb0ef41Sopenharmony_ci  )
611cb0ef41Sopenharmony_ci  .end('asd')
621cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
631cb0ef41Sopenharmony_ci    res += buf;
641cb0ef41Sopenharmony_ci  }))
651cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
661cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASDASD');
671cb0ef41Sopenharmony_ci  }));
681cb0ef41Sopenharmony_ci}
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ci{
711cb0ef41Sopenharmony_ci  let res = '';
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ci  compose(
741cb0ef41Sopenharmony_ci    async function*(source) {
751cb0ef41Sopenharmony_ci      for await (const chunk of source) {
761cb0ef41Sopenharmony_ci        yield chunk + chunk;
771cb0ef41Sopenharmony_ci      }
781cb0ef41Sopenharmony_ci    },
791cb0ef41Sopenharmony_ci    new TransformStream({
801cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
811cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
821cb0ef41Sopenharmony_ci      }),
831cb0ef41Sopenharmony_ci    })
841cb0ef41Sopenharmony_ci  )
851cb0ef41Sopenharmony_ci  .end('asd')
861cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
871cb0ef41Sopenharmony_ci    res += buf;
881cb0ef41Sopenharmony_ci  }))
891cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
901cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASDASD');
911cb0ef41Sopenharmony_ci  }));
921cb0ef41Sopenharmony_ci}
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci{
951cb0ef41Sopenharmony_ci  let res = '';
961cb0ef41Sopenharmony_ci
971cb0ef41Sopenharmony_ci  compose(
981cb0ef41Sopenharmony_ci    new TransformStream({
991cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
1001cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
1011cb0ef41Sopenharmony_ci      }),
1021cb0ef41Sopenharmony_ci    }),
1031cb0ef41Sopenharmony_ci    async function*(source) {
1041cb0ef41Sopenharmony_ci      for await (const chunk of source) {
1051cb0ef41Sopenharmony_ci        yield chunk + chunk;
1061cb0ef41Sopenharmony_ci      }
1071cb0ef41Sopenharmony_ci    },
1081cb0ef41Sopenharmony_ci    new Transform({
1091cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, enc, clb) => {
1101cb0ef41Sopenharmony_ci        clb(null, chunk?.toString()?.replaceAll('A', 'B'));
1111cb0ef41Sopenharmony_ci      })
1121cb0ef41Sopenharmony_ci    })
1131cb0ef41Sopenharmony_ci  )
1141cb0ef41Sopenharmony_ci  .end('asd')
1151cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
1161cb0ef41Sopenharmony_ci    res += buf;
1171cb0ef41Sopenharmony_ci  }))
1181cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
1191cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'BSDBSD');
1201cb0ef41Sopenharmony_ci  }));
1211cb0ef41Sopenharmony_ci}
1221cb0ef41Sopenharmony_ci
1231cb0ef41Sopenharmony_ci{
1241cb0ef41Sopenharmony_ci  let res = '';
1251cb0ef41Sopenharmony_ci
1261cb0ef41Sopenharmony_ci  compose(
1271cb0ef41Sopenharmony_ci    new TransformStream({
1281cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
1291cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
1301cb0ef41Sopenharmony_ci      }),
1311cb0ef41Sopenharmony_ci    }),
1321cb0ef41Sopenharmony_ci    async function*(source) {
1331cb0ef41Sopenharmony_ci      for await (const chunk of source) {
1341cb0ef41Sopenharmony_ci        yield chunk + chunk;
1351cb0ef41Sopenharmony_ci      }
1361cb0ef41Sopenharmony_ci    },
1371cb0ef41Sopenharmony_ci    new TransformStream({
1381cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
1391cb0ef41Sopenharmony_ci        controller.enqueue(chunk?.toString()?.replaceAll('A', 'B'));
1401cb0ef41Sopenharmony_ci      })
1411cb0ef41Sopenharmony_ci    })
1421cb0ef41Sopenharmony_ci  )
1431cb0ef41Sopenharmony_ci  .end('asd')
1441cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
1451cb0ef41Sopenharmony_ci    res += buf;
1461cb0ef41Sopenharmony_ci  }))
1471cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
1481cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'BSDBSD');
1491cb0ef41Sopenharmony_ci  }));
1501cb0ef41Sopenharmony_ci}
1511cb0ef41Sopenharmony_ci
1521cb0ef41Sopenharmony_ci{
1531cb0ef41Sopenharmony_ci  let res = '';
1541cb0ef41Sopenharmony_ci  compose(
1551cb0ef41Sopenharmony_ci    new ReadableStream({
1561cb0ef41Sopenharmony_ci      start(controller) {
1571cb0ef41Sopenharmony_ci        controller.enqueue('asd');
1581cb0ef41Sopenharmony_ci        controller.close();
1591cb0ef41Sopenharmony_ci      }
1601cb0ef41Sopenharmony_ci    }),
1611cb0ef41Sopenharmony_ci    new TransformStream({
1621cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
1631cb0ef41Sopenharmony_ci        controller.enqueue(chunk?.toString()?.toUpperCase());
1641cb0ef41Sopenharmony_ci      })
1651cb0ef41Sopenharmony_ci    })
1661cb0ef41Sopenharmony_ci  )
1671cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
1681cb0ef41Sopenharmony_ci    res += buf;
1691cb0ef41Sopenharmony_ci  }))
1701cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
1711cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASD');
1721cb0ef41Sopenharmony_ci  }));
1731cb0ef41Sopenharmony_ci}
1741cb0ef41Sopenharmony_ci
1751cb0ef41Sopenharmony_ci{
1761cb0ef41Sopenharmony_ci  let res = '';
1771cb0ef41Sopenharmony_ci  compose(
1781cb0ef41Sopenharmony_ci    new ReadableStream({
1791cb0ef41Sopenharmony_ci      start(controller) {
1801cb0ef41Sopenharmony_ci        controller.enqueue('asd');
1811cb0ef41Sopenharmony_ci        controller.close();
1821cb0ef41Sopenharmony_ci      }
1831cb0ef41Sopenharmony_ci    }),
1841cb0ef41Sopenharmony_ci    new Transform({
1851cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, enc, clb) => {
1861cb0ef41Sopenharmony_ci        clb(null, chunk?.toString()?.toUpperCase());
1871cb0ef41Sopenharmony_ci      })
1881cb0ef41Sopenharmony_ci    })
1891cb0ef41Sopenharmony_ci  )
1901cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
1911cb0ef41Sopenharmony_ci    res += buf;
1921cb0ef41Sopenharmony_ci  }))
1931cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
1941cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASD');
1951cb0ef41Sopenharmony_ci  }));
1961cb0ef41Sopenharmony_ci}
1971cb0ef41Sopenharmony_ci
1981cb0ef41Sopenharmony_ci{
1991cb0ef41Sopenharmony_ci  let res = '';
2001cb0ef41Sopenharmony_ci  compose(
2011cb0ef41Sopenharmony_ci    Readable.from(['asd']),
2021cb0ef41Sopenharmony_ci    new TransformStream({
2031cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
2041cb0ef41Sopenharmony_ci        controller.enqueue(chunk?.toString()?.toUpperCase());
2051cb0ef41Sopenharmony_ci      })
2061cb0ef41Sopenharmony_ci    })
2071cb0ef41Sopenharmony_ci  )
2081cb0ef41Sopenharmony_ci  .on('data', common.mustCall((buf) => {
2091cb0ef41Sopenharmony_ci    res += buf;
2101cb0ef41Sopenharmony_ci  }))
2111cb0ef41Sopenharmony_ci  .on('end', common.mustCall(() => {
2121cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASD');
2131cb0ef41Sopenharmony_ci  }));
2141cb0ef41Sopenharmony_ci}
2151cb0ef41Sopenharmony_ci
2161cb0ef41Sopenharmony_ci{
2171cb0ef41Sopenharmony_ci  let res = '';
2181cb0ef41Sopenharmony_ci  compose(
2191cb0ef41Sopenharmony_ci    new TransformStream({
2201cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
2211cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
2221cb0ef41Sopenharmony_ci      })
2231cb0ef41Sopenharmony_ci    }),
2241cb0ef41Sopenharmony_ci    async function*(source) {
2251cb0ef41Sopenharmony_ci      for await (const chunk of source) {
2261cb0ef41Sopenharmony_ci        yield chunk;
2271cb0ef41Sopenharmony_ci      }
2281cb0ef41Sopenharmony_ci    },
2291cb0ef41Sopenharmony_ci    new Writable({
2301cb0ef41Sopenharmony_ci      write: common.mustCall((chunk, encoding, callback) => {
2311cb0ef41Sopenharmony_ci        res += chunk;
2321cb0ef41Sopenharmony_ci        callback(null);
2331cb0ef41Sopenharmony_ci      })
2341cb0ef41Sopenharmony_ci    })
2351cb0ef41Sopenharmony_ci  )
2361cb0ef41Sopenharmony_ci    .end('asd')
2371cb0ef41Sopenharmony_ci    .on('finish', common.mustCall(() => {
2381cb0ef41Sopenharmony_ci      assert.strictEqual(res, 'ASD');
2391cb0ef41Sopenharmony_ci    }));
2401cb0ef41Sopenharmony_ci}
2411cb0ef41Sopenharmony_ci
2421cb0ef41Sopenharmony_ci{
2431cb0ef41Sopenharmony_ci  let res = '';
2441cb0ef41Sopenharmony_ci  compose(
2451cb0ef41Sopenharmony_ci    new Transform({
2461cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, encoding, callback) => {
2471cb0ef41Sopenharmony_ci        callback(null, chunk.toString().toUpperCase());
2481cb0ef41Sopenharmony_ci      })
2491cb0ef41Sopenharmony_ci    }),
2501cb0ef41Sopenharmony_ci    async function*(source) {
2511cb0ef41Sopenharmony_ci      for await (const chunk of source) {
2521cb0ef41Sopenharmony_ci        yield chunk;
2531cb0ef41Sopenharmony_ci      }
2541cb0ef41Sopenharmony_ci    },
2551cb0ef41Sopenharmony_ci    new WritableStream({
2561cb0ef41Sopenharmony_ci      write: common.mustCall((chunk) => {
2571cb0ef41Sopenharmony_ci        res += chunk;
2581cb0ef41Sopenharmony_ci      })
2591cb0ef41Sopenharmony_ci    })
2601cb0ef41Sopenharmony_ci  )
2611cb0ef41Sopenharmony_ci  .end('asd')
2621cb0ef41Sopenharmony_ci  .on('finish', common.mustCall(() => {
2631cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASD');
2641cb0ef41Sopenharmony_ci  }));
2651cb0ef41Sopenharmony_ci}
2661cb0ef41Sopenharmony_ci
2671cb0ef41Sopenharmony_ci{
2681cb0ef41Sopenharmony_ci  let res = '';
2691cb0ef41Sopenharmony_ci  compose(
2701cb0ef41Sopenharmony_ci    new TransformStream({
2711cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
2721cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
2731cb0ef41Sopenharmony_ci      })
2741cb0ef41Sopenharmony_ci    }),
2751cb0ef41Sopenharmony_ci    async function*(source) {
2761cb0ef41Sopenharmony_ci      for await (const chunk of source) {
2771cb0ef41Sopenharmony_ci        yield chunk;
2781cb0ef41Sopenharmony_ci      }
2791cb0ef41Sopenharmony_ci    },
2801cb0ef41Sopenharmony_ci    new WritableStream({
2811cb0ef41Sopenharmony_ci      write: common.mustCall((chunk) => {
2821cb0ef41Sopenharmony_ci        res += chunk;
2831cb0ef41Sopenharmony_ci      })
2841cb0ef41Sopenharmony_ci    })
2851cb0ef41Sopenharmony_ci  )
2861cb0ef41Sopenharmony_ci  .end('asd')
2871cb0ef41Sopenharmony_ci  .on('finish', common.mustCall(() => {
2881cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASD');
2891cb0ef41Sopenharmony_ci  }));
2901cb0ef41Sopenharmony_ci}
2911cb0ef41Sopenharmony_ci
2921cb0ef41Sopenharmony_ci{
2931cb0ef41Sopenharmony_ci  let res = '';
2941cb0ef41Sopenharmony_ci  compose(
2951cb0ef41Sopenharmony_ci    new TransformStream({
2961cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
2971cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
2981cb0ef41Sopenharmony_ci      })
2991cb0ef41Sopenharmony_ci    }),
3001cb0ef41Sopenharmony_ci    async function*(source) {
3011cb0ef41Sopenharmony_ci      for await (const chunk of source) {
3021cb0ef41Sopenharmony_ci        yield chunk;
3031cb0ef41Sopenharmony_ci      }
3041cb0ef41Sopenharmony_ci    },
3051cb0ef41Sopenharmony_ci    async function(source) {
3061cb0ef41Sopenharmony_ci      for await (const chunk of source) {
3071cb0ef41Sopenharmony_ci        res += chunk;
3081cb0ef41Sopenharmony_ci      }
3091cb0ef41Sopenharmony_ci    }
3101cb0ef41Sopenharmony_ci  )
3111cb0ef41Sopenharmony_ci  .end('asd')
3121cb0ef41Sopenharmony_ci  .on('finish', common.mustCall(() => {
3131cb0ef41Sopenharmony_ci    assert.strictEqual(res, 'ASD');
3141cb0ef41Sopenharmony_ci  }));
3151cb0ef41Sopenharmony_ci}
3161cb0ef41Sopenharmony_ci
3171cb0ef41Sopenharmony_ci{
3181cb0ef41Sopenharmony_ci
3191cb0ef41Sopenharmony_ci  compose(
3201cb0ef41Sopenharmony_ci    new TransformStream({
3211cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
3221cb0ef41Sopenharmony_ci        controller.error(new Error('asd'));
3231cb0ef41Sopenharmony_ci      })
3241cb0ef41Sopenharmony_ci    }),
3251cb0ef41Sopenharmony_ci    new TransformStream({
3261cb0ef41Sopenharmony_ci      transform: common.mustNotCall()
3271cb0ef41Sopenharmony_ci    })
3281cb0ef41Sopenharmony_ci  )
3291cb0ef41Sopenharmony_ci  .on('data', common.mustNotCall())
3301cb0ef41Sopenharmony_ci  .on('end', common.mustNotCall())
3311cb0ef41Sopenharmony_ci  .on('error', (err) => {
3321cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
3331cb0ef41Sopenharmony_ci  })
3341cb0ef41Sopenharmony_ci  .end('xyz');
3351cb0ef41Sopenharmony_ci}
3361cb0ef41Sopenharmony_ci
3371cb0ef41Sopenharmony_ci{
3381cb0ef41Sopenharmony_ci
3391cb0ef41Sopenharmony_ci  compose(
3401cb0ef41Sopenharmony_ci    new TransformStream({
3411cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
3421cb0ef41Sopenharmony_ci        controller.enqueue(chunk);
3431cb0ef41Sopenharmony_ci      })
3441cb0ef41Sopenharmony_ci    }),
3451cb0ef41Sopenharmony_ci    new TransformStream({
3461cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
3471cb0ef41Sopenharmony_ci        controller.error(new Error('asd'));
3481cb0ef41Sopenharmony_ci      })
3491cb0ef41Sopenharmony_ci    })
3501cb0ef41Sopenharmony_ci  )
3511cb0ef41Sopenharmony_ci  .on('data', common.mustNotCall())
3521cb0ef41Sopenharmony_ci  .on('end', common.mustNotCall())
3531cb0ef41Sopenharmony_ci  .on('error', (err) => {
3541cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
3551cb0ef41Sopenharmony_ci  })
3561cb0ef41Sopenharmony_ci  .end('xyz');
3571cb0ef41Sopenharmony_ci}
3581cb0ef41Sopenharmony_ci
3591cb0ef41Sopenharmony_ci{
3601cb0ef41Sopenharmony_ci
3611cb0ef41Sopenharmony_ci  compose(
3621cb0ef41Sopenharmony_ci    new TransformStream({
3631cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
3641cb0ef41Sopenharmony_ci        controller.enqueue(chunk);
3651cb0ef41Sopenharmony_ci      })
3661cb0ef41Sopenharmony_ci    }),
3671cb0ef41Sopenharmony_ci    async function*(source) { // eslint-disable-line require-yield
3681cb0ef41Sopenharmony_ci      let tmp = '';
3691cb0ef41Sopenharmony_ci      for await (const chunk of source) {
3701cb0ef41Sopenharmony_ci        tmp += chunk;
3711cb0ef41Sopenharmony_ci        throw new Error('asd');
3721cb0ef41Sopenharmony_ci      }
3731cb0ef41Sopenharmony_ci      return tmp;
3741cb0ef41Sopenharmony_ci    },
3751cb0ef41Sopenharmony_ci    new TransformStream({
3761cb0ef41Sopenharmony_ci      transform: common.mustNotCall()
3771cb0ef41Sopenharmony_ci    })
3781cb0ef41Sopenharmony_ci  )
3791cb0ef41Sopenharmony_ci  .on('data', common.mustNotCall())
3801cb0ef41Sopenharmony_ci  .on('end', common.mustNotCall())
3811cb0ef41Sopenharmony_ci  .on('error', (err) => {
3821cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
3831cb0ef41Sopenharmony_ci  })
3841cb0ef41Sopenharmony_ci  .end('xyz');
3851cb0ef41Sopenharmony_ci}
3861cb0ef41Sopenharmony_ci
3871cb0ef41Sopenharmony_ci{
3881cb0ef41Sopenharmony_ci
3891cb0ef41Sopenharmony_ci  compose(
3901cb0ef41Sopenharmony_ci    new TransformStream({
3911cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
3921cb0ef41Sopenharmony_ci        controller.error(new Error('asd'));
3931cb0ef41Sopenharmony_ci      })
3941cb0ef41Sopenharmony_ci    }),
3951cb0ef41Sopenharmony_ci    new Transform({
3961cb0ef41Sopenharmony_ci      transform: common.mustNotCall()
3971cb0ef41Sopenharmony_ci    })
3981cb0ef41Sopenharmony_ci  )
3991cb0ef41Sopenharmony_ci  .on('data', common.mustNotCall())
4001cb0ef41Sopenharmony_ci  .on('end', common.mustNotCall())
4011cb0ef41Sopenharmony_ci  .on('error', (err) => {
4021cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
4031cb0ef41Sopenharmony_ci  })
4041cb0ef41Sopenharmony_ci  .end('xyz');
4051cb0ef41Sopenharmony_ci}
4061cb0ef41Sopenharmony_ci
4071cb0ef41Sopenharmony_ci{
4081cb0ef41Sopenharmony_ci
4091cb0ef41Sopenharmony_ci  compose(
4101cb0ef41Sopenharmony_ci    new Transform({
4111cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, enc, clb) => {
4121cb0ef41Sopenharmony_ci        clb(new Error('asd'));
4131cb0ef41Sopenharmony_ci      })
4141cb0ef41Sopenharmony_ci    }),
4151cb0ef41Sopenharmony_ci    new TransformStream({
4161cb0ef41Sopenharmony_ci      transform: common.mustNotCall()
4171cb0ef41Sopenharmony_ci    })
4181cb0ef41Sopenharmony_ci  )
4191cb0ef41Sopenharmony_ci  .on('data', common.mustNotCall())
4201cb0ef41Sopenharmony_ci  .on('end', common.mustNotCall())
4211cb0ef41Sopenharmony_ci  .on('error', (err) => {
4221cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
4231cb0ef41Sopenharmony_ci  })
4241cb0ef41Sopenharmony_ci  .end('xyz');
4251cb0ef41Sopenharmony_ci}
4261cb0ef41Sopenharmony_ci
4271cb0ef41Sopenharmony_ci{
4281cb0ef41Sopenharmony_ci  compose(
4291cb0ef41Sopenharmony_ci    new ReadableStream({
4301cb0ef41Sopenharmony_ci      start(controller) {
4311cb0ef41Sopenharmony_ci        controller.enqueue(new Error('asd'));
4321cb0ef41Sopenharmony_ci      }
4331cb0ef41Sopenharmony_ci    }),
4341cb0ef41Sopenharmony_ci    new TransformStream({
4351cb0ef41Sopenharmony_ci      transform: common.mustNotCall()
4361cb0ef41Sopenharmony_ci    })
4371cb0ef41Sopenharmony_ci  )
4381cb0ef41Sopenharmony_ci  .on('data', common.mustNotCall())
4391cb0ef41Sopenharmony_ci  .on('end', common.mustNotCall())
4401cb0ef41Sopenharmony_ci  .on('error', (err) => {
4411cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
4421cb0ef41Sopenharmony_ci  })
4431cb0ef41Sopenharmony_ci  .end('xyz');
4441cb0ef41Sopenharmony_ci}
4451cb0ef41Sopenharmony_ci
4461cb0ef41Sopenharmony_ci{
4471cb0ef41Sopenharmony_ci  compose(
4481cb0ef41Sopenharmony_ci    new TransformStream({
4491cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
4501cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
4511cb0ef41Sopenharmony_ci      })
4521cb0ef41Sopenharmony_ci    }),
4531cb0ef41Sopenharmony_ci    new WritableStream({
4541cb0ef41Sopenharmony_ci      write: common.mustCall((chunk, controller) => {
4551cb0ef41Sopenharmony_ci        controller.error(new Error('asd'));
4561cb0ef41Sopenharmony_ci      })
4571cb0ef41Sopenharmony_ci    })
4581cb0ef41Sopenharmony_ci  )
4591cb0ef41Sopenharmony_ci  .on('error', (err) => {
4601cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
4611cb0ef41Sopenharmony_ci  })
4621cb0ef41Sopenharmony_ci  .end('xyz');
4631cb0ef41Sopenharmony_ci}
4641cb0ef41Sopenharmony_ci
4651cb0ef41Sopenharmony_ci{
4661cb0ef41Sopenharmony_ci  compose(
4671cb0ef41Sopenharmony_ci    new TransformStream({
4681cb0ef41Sopenharmony_ci      transform: common.mustCall((chunk, controller) => {
4691cb0ef41Sopenharmony_ci        controller.enqueue(chunk.toString().toUpperCase());
4701cb0ef41Sopenharmony_ci      })
4711cb0ef41Sopenharmony_ci    }),
4721cb0ef41Sopenharmony_ci    async function*(source) {
4731cb0ef41Sopenharmony_ci      for await (const chunk of source) {
4741cb0ef41Sopenharmony_ci        yield chunk;
4751cb0ef41Sopenharmony_ci      }
4761cb0ef41Sopenharmony_ci    },
4771cb0ef41Sopenharmony_ci    async function(source) {
4781cb0ef41Sopenharmony_ci      throw new Error('asd');
4791cb0ef41Sopenharmony_ci    }
4801cb0ef41Sopenharmony_ci  ).on('error', (err) => {
4811cb0ef41Sopenharmony_ci    assert.strictEqual(err?.message, 'asd');
4821cb0ef41Sopenharmony_ci  }).end('xyz');
4831cb0ef41Sopenharmony_ci}
484