Update the testing framework from tab to lab with code assertion library
A while back, we have discussed on how to use the testing framework - Tab. You are not fully satisfied with it and intend to switch to Lab. I have already seen that you have tried Lab/Code in your latest git repo project.
I started to take a crack at it. Here is what I get so far. It is not in the merging stage with a few issues.
- In
npm testscripts, uselabwith coverage flag, got message in output after running the test.template.js missing coverage on line(s). I think that we are ignoring thetemplate.jsin this case. How to setup inlabcommand? - By including the test
stream.js, it has doubled our test cases. I think it is the natural event listeners which is fired when thetest.jstest executed. But inTab, it only outputs two tests, which is total of 16 test cases instead of 26. - in
test.js, line 33, I did not like the way that it has to calldone(), thencb()styles. Inthrough2, it requires to callcb(). InLab, it requires to pass in an argument ofdone. How could I make it more elegant? - isolate the contents of the individual files includes two different files for testing. If I remove the
skip, it will actually run the test, then output an warning.Multiple callbacks or thrown errors received in test: WrapAmd module should isolate the contents of the individual files (done).
I took a look at this. Thinking maybe we should do something differently than expectStream since we have to call done now instead of using t.plan to plan the number of assertions.
Yes. I agree. ExpectStream would have always call cb() to pass the control back to through2. Calling done() before cb() is totally a hack. We are doing two separated logic in one function is not permitted.
Do you think creating a plain Vinyl and paring with a pure stream is the way to go?
Yeah, I think that writing a vinyl object to the wrap stream makes more sense than using gulp. Many plugins switched to that pattern.
OK. It is time to write some UNIT tests. Ha Ha Ha...
I have not forgotten about this, just have been busy working on several other things. I will get back with it soon.