Closed hollowdoor closed 7 years ago
Since the input could contain an arbitrary number of TAP streams concatenated one after the other, tap-merge
can't (and won't) print the final plan line until the input stream has ended.
I'm not sure what you mean by "writing directly". If you mean interactively starting tap-merge
on the command line, and manually typing lines of TAP to give it input, then you'll need to hit Ctrld once you're done to send an end-of-file character. That's the interactive shell equivalent of calling stream.end()
in Node.js .
If that's not what you meant, could you give a brief example to illustrate?
I'm not sure what you mean by "writing directly".
Here's what I mean. Do let mergedStream = require('tap-merge')();
, and using mergedStream.wite(data)
instead of piping the streams, and letting them pass data on their own. I may have done a bad job of communicating there. Sorry. Maybe I should just say "writing to the stream with the stream.write()
method".
Since the input could contain an arbitrary number of TAP streams concatenated one after the other, tap-merge can't (and won't) print the final plan line until the input stream has ended.
Yeah I figured that out after some thought. Then I posted this issue. Because I had to think about it I thought it would be a good idea to add a note to the to the readme about that requirement to warn others who would use mergedStream.write(data);
instead of piping.
Maybe I don't understand streams. Or node streams are hard to think about. Is it traditional for streams to not end unless there is a call to stream.end()
even when a through stream is piped to some other stream? Honestly I don't have code call stream.write(data)
all that often so it's possible I've forgotten.
Ok the docs are pretty explicit about this. https://nodejs.org/api/stream.html#stream_writable_end_chunk_encoding_callback
Sorry about all this.
I tried writing directly to the
tap-merge
stream. It works quite well with items being numbered correctly.But no plan prints out.
Calling
mergedStream.end()
did print the plan though. Maybe this behavior should be recorded in the readme.