Closed naugtur closed 7 years ago
Hm hm hm. This library shouldn't really care about what kind of scripts it's running. I'm curious, all this does seems to be the same as what tape-run
does, so does this even fix anything?
It does kill the browser when tape tests finish. So it works. I agree browser-run should not be concerned in what the script it's running is doing. That's why I'm not sure if a tap - specific fix is ok.
Anyway, tap-finish is monitoring a stream for the test summary output and once it shows up, runs the callback, so I can close the browser. tap-spec won't be able to close the browser-run process, because it's after browser-run in the pipe.
browserify test/index.js | browser-run | tap-spec
browser-run needs to end so that the whole pipe can fold to tap-spec's exit code.
This implementation is inspired by what I found in run-browser
package.
Manually closing browsers after tests puts a hamper on automated testing. If this change fixes that, it would be a benefit for me. I'm not aware of a universal way to detect test completion... perhaps a broader catch could be implemented (shut down resources after no output for configurable number of millis) - any output, not just tap.... I would be OK with that too. But this is a great start to see if at least this takes care of it for tap testing - would love to see this go in.
Would https://github.com/juliangruber/tape-run not fix exactly this?
It's just a super light wrapper around browser-run https://github.com/juliangruber/tape-run/blob/master/index.js
Looks good for the tape case. Especially if it exposes all browser-run options.
So for browser-run we're looking for a more generic solution that would ensure browser termination for all types of tests and frameworks based on something
Yeah, I think one wrapper per major test framework is a fine option. tape-run should pass all options to browser-run, and open an issue if not :)
Requesting comments. This is related to #121