Re: [whatwg/streams] rework recording-streams helper (#609)

I strongly agree with the principle of recording and testing the relative ordering of events, rather than relying on timeouts.

However, the complexity of these test utilities makes me very uncomfortable.

One of the principles I apply when writing test fixtures or utilities is that it's better to have several small specific ones than one large general one. There's a couple of reasons for this:

1. Generally you only need to understand one test case at a time (the one that's broken). Therefore minimising the size of the dependencies for each test is a higher priority than minimising the total size of the test suite.
2. Test fixtures and utils are generally not themselves tested. So the need for them to be "obviously correct" is even more extreme than for other kinds of code.

The existing recordingReadableStream is already at the upper limit of complexity I am comfortable with in test utilities.

I agree with @domenic about keeping recording-streams.js as-is. Then I would recommend thinking about the simplest possible test utility that would let you write the tests you need right now. I'd rather have five 10-line test utilities than one 30-line one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/609#issuecomment-259871921

Received on Friday, 11 November 2016 03:23:38 UTC