Skip to content

Commit 46ab61c

Browse files
committed
stream: reorder stream/iter tests
1 parent 9940243 commit 46ab61c

File tree

5 files changed

+87
-87
lines changed

5 files changed

+87
-87
lines changed

test/parallel/test-stream-iter-broadcast-basic.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,20 @@ async function testCancelWithFalsyReason() {
229229
assert.strictEqual(result, 0);
230230
}
231231

232+
// Late-joining consumer should read from oldest buffered entry
233+
async function testLateJoinerSeesBufferedData() {
234+
const { writer, broadcast: bc } = broadcast({ highWaterMark: 16 });
235+
236+
// Write data before any consumer joins
237+
writer.writeSync('before-join');
238+
writer.endSync();
239+
240+
// Consumer joins after data is written
241+
const consumer = bc.push();
242+
const result = await text(consumer);
243+
assert.strictEqual(result, 'before-join');
244+
}
245+
232246
Promise.all([
233247
testBasicBroadcast(),
234248
testMultipleWrites(),
@@ -244,17 +258,3 @@ Promise.all([
244258
testWriterFailIdempotent(),
245259
testLateJoinerSeesBufferedData(),
246260
]).then(common.mustCall());
247-
248-
// Late-joining consumer should read from oldest buffered entry
249-
async function testLateJoinerSeesBufferedData() {
250-
const { writer, broadcast: bc } = broadcast({ highWaterMark: 16 });
251-
252-
// Write data before any consumer joins
253-
writer.writeSync('before-join');
254-
writer.endSync();
255-
256-
// Consumer joins after data is written
257-
const consumer = bc.push();
258-
const result = await text(consumer);
259-
assert.strictEqual(result, 'before-join');
260-
}

test/parallel/test-stream-iter-pull-async.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -266,37 +266,6 @@ async function testPullTransformYieldsStrings() {
266266
assert.strictEqual(result, 'hello');
267267
}
268268

269-
// Run the uncaughtException test sequentially (it installs a global handler
270-
// that would interfere with concurrent tests).
271-
(async () => {
272-
await Promise.all([
273-
testPullIdentity(),
274-
testPullStatelessTransform(),
275-
testPullStatefulTransform(),
276-
testPullWithAbortSignal(),
277-
testPullChainedTransforms(),
278-
testPullSourceError(),
279-
testTapCallbackError(),
280-
testPullSignalAbortMidIteration(),
281-
testPullConsumerBreakCleanup(),
282-
testPullTransformReturnsPromise(),
283-
testPullTransformYieldsStrings(),
284-
testPullStatelessTransformError(),
285-
testPullStatefulTransformError(),
286-
testPullStatelessTransformFlush(),
287-
testPullStatelessTransformFlushError(),
288-
testPullWithSyncSource(),
289-
testPullStringSource(),
290-
testTransformReturnsSingleUint8Array(),
291-
testTransformReturnsSingleString(),
292-
testTransformReturnsArrayBuffer(),
293-
testPipeToStringSource(),
294-
testTransformOptionsNotShared(),
295-
]);
296-
// Run after all concurrent tests complete to avoid global handler races
297-
await testTransformSignalListenerErrorOnSourceError();
298-
})().then(common.mustCall());
299-
300269
// pull() accepts a string source directly (normalized via from())
301270
async function testPullStringSource() {
302271
const data = await text(pull('hello-direct'));
@@ -369,3 +338,34 @@ async function testTransformOptionsNotShared() {
369338
// transform2 gets a fresh options object - no mutation visible
370339
assert.strictEqual(seen[1].mutated, undefined);
371340
}
341+
342+
// Run the uncaughtException test sequentially (it installs a global handler
343+
// that would interfere with concurrent tests).
344+
(async () => {
345+
await Promise.all([
346+
testPullIdentity(),
347+
testPullStatelessTransform(),
348+
testPullStatefulTransform(),
349+
testPullWithAbortSignal(),
350+
testPullChainedTransforms(),
351+
testPullSourceError(),
352+
testTapCallbackError(),
353+
testPullSignalAbortMidIteration(),
354+
testPullConsumerBreakCleanup(),
355+
testPullTransformReturnsPromise(),
356+
testPullTransformYieldsStrings(),
357+
testPullStatelessTransformError(),
358+
testPullStatefulTransformError(),
359+
testPullStatelessTransformFlush(),
360+
testPullStatelessTransformFlushError(),
361+
testPullWithSyncSource(),
362+
testPullStringSource(),
363+
testTransformReturnsSingleUint8Array(),
364+
testTransformReturnsSingleString(),
365+
testTransformReturnsArrayBuffer(),
366+
testPipeToStringSource(),
367+
testTransformOptionsNotShared(),
368+
]);
369+
// Run after all concurrent tests complete to avoid global handler races
370+
await testTransformSignalListenerErrorOnSourceError();
371+
})().then(common.mustCall());

test/parallel/test-stream-iter-push-writer.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -330,34 +330,6 @@ async function testEndRejectsPendingWrites() {
330330
for await (const _ of readable) { break; }
331331
}
332332

333-
Promise.all([
334-
testOndrain(),
335-
testOndrainNonDrainable(),
336-
testWriteWithSignalRejects(),
337-
testWriteWithPreAbortedSignal(),
338-
testCancelledWriteRemovedFromQueue(),
339-
testOndrainResolvesFalseOnConsumerBreak(),
340-
testOndrainRejectsOnConsumerThrow(),
341-
testWritev(),
342-
testWritevSync(),
343-
testWritevMixedTypes(),
344-
testWriteAfterEnd(),
345-
testWriteAfterFail(),
346-
testOndrainProtocolErrorPropagates(),
347-
testFail(),
348-
testEndAsyncReturnValue(),
349-
testWriteUint8Array(),
350-
testOndrainWaitsForDrain(),
351-
testConsumerThrowRejectsWrites(),
352-
testEndResolvesPendingRead(),
353-
testFailRejectsPendingRead(),
354-
testEndRejectsPendingWrites(),
355-
testEndIdempotentWhenClosed(),
356-
testEndRejectsWhenErrored(),
357-
testAsyncDispose(),
358-
testSyncDispose(),
359-
]).then(common.mustCall());
360-
361333
async function testEndIdempotentWhenClosed() {
362334
const { writer, readable } = push({ highWaterMark: 10 });
363335
await writer.write('hello');
@@ -424,3 +396,31 @@ async function testEndRejectsWhenErrored() {
424396
// Expected - reader may see the error
425397
}
426398
}
399+
400+
Promise.all([
401+
testOndrain(),
402+
testOndrainNonDrainable(),
403+
testWriteWithSignalRejects(),
404+
testWriteWithPreAbortedSignal(),
405+
testCancelledWriteRemovedFromQueue(),
406+
testOndrainResolvesFalseOnConsumerBreak(),
407+
testOndrainRejectsOnConsumerThrow(),
408+
testWritev(),
409+
testWritevSync(),
410+
testWritevMixedTypes(),
411+
testWriteAfterEnd(),
412+
testWriteAfterFail(),
413+
testOndrainProtocolErrorPropagates(),
414+
testFail(),
415+
testEndAsyncReturnValue(),
416+
testWriteUint8Array(),
417+
testOndrainWaitsForDrain(),
418+
testConsumerThrowRejectsWrites(),
419+
testEndResolvesPendingRead(),
420+
testFailRejectsPendingRead(),
421+
testEndRejectsPendingWrites(),
422+
testEndIdempotentWhenClosed(),
423+
testEndRejectsWhenErrored(),
424+
testAsyncDispose(),
425+
testSyncDispose(),
426+
]).then(common.mustCall());

test/parallel/test-stream-iter-share-async.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ async function testShareMultipleConsumersConcurrentPull() {
258258
assert.strictEqual(t3, expected);
259259
}
260260

261+
// share() accepts string source directly (normalized via from())
262+
async function testShareStringSource() {
263+
const shared = share('hello-share');
264+
const result = await text(shared.pull());
265+
assert.strictEqual(result, 'hello-share');
266+
}
267+
261268
Promise.all([
262269
testBasicShare(),
263270
testShareMultipleConsumers(),
@@ -273,10 +280,3 @@ Promise.all([
273280
testShareMultipleConsumersConcurrentPull(),
274281
testShareStringSource(),
275282
]).then(common.mustCall());
276-
277-
// share() accepts string source directly (normalized via from())
278-
async function testShareStringSource() {
279-
const shared = share('hello-share');
280-
const result = await text(shared.pull());
281-
assert.strictEqual(result, 'hello-share');
282-
}

test/parallel/test-stream-iter-share-sync.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ function testShareSyncSourceError() {
144144
}, { message: 'sync share boom' });
145145
}
146146

147+
// shareSync() accepts string source directly (normalized via fromSync())
148+
function testShareSyncStringSource() {
149+
const shared = shareSync('hello-sync-share');
150+
const result = textSync(shared.pull());
151+
assert.strictEqual(result, 'hello-sync-share');
152+
}
153+
147154
Promise.all([
148155
testShareSyncBasic(),
149156
testShareSyncMultipleConsumers(),
@@ -153,10 +160,3 @@ Promise.all([
153160
testShareSyncSourceError(),
154161
testShareSyncStringSource(),
155162
]).then(common.mustCall());
156-
157-
// shareSync() accepts string source directly (normalized via fromSync())
158-
function testShareSyncStringSource() {
159-
const shared = shareSync('hello-sync-share');
160-
const result = textSync(shared.pull());
161-
assert.strictEqual(result, 'hello-sync-share');
162-
}

0 commit comments

Comments
 (0)