Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(launcher): output stderr for failing launchers #2639

Conversation

twolfson
Copy link
Contributor

In twolfson/karma-electron#17, twolfson/karma-electron#22, and personal experience, there's been scenarios when we're setting up Karma in CI and it's erroring out with no useful feedback. Typically this is due to a system dependency (e.g. missed an apt-get step).

This PR aims to resolve that by adding stderr to the output of failing launchers. In this PR:

  • Added stderr output to launcher errorOutput
    • We didn't know if we wanted to be clever and indent everything so we went the simple route for now

Before:

30 03 2017 04:00:46.897:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/
30 03 2017 04:00:46.899:INFO [launcher]: Launching browser Firefox with unlimited concurrency
30 03 2017 04:00:46.906:INFO [launcher]: Starting browser Firefox
30 03 2017 04:00:46.922:ERROR [launcher]: Cannot start Firefox
	
30 03 2017 04:00:46.929:INFO [launcher]: Trying to start Firefox again (1/2).
30 03 2017 04:00:46.936:ERROR [launcher]: Cannot start Firefox
	
30 03 2017 04:00:46.940:INFO [launcher]: Trying to start Firefox again (2/2).
30 03 2017 04:00:46.949:ERROR [launcher]: Cannot start Firefox
	
30 03 2017 04:00:46.952:ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
npm ERR! Test failed.  See above for more details.

After:

> gist-karma-launcher-fail@1.0.0 test /docker
> FIREFOX_BIN=$PWD/vendor/firefox/firefox karma start

30 03 2017 04:27:58.879:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/
30 03 2017 04:27:58.881:INFO [launcher]: Launching browser Firefox with unlimited concurrency
30 03 2017 04:27:58.888:INFO [launcher]: Starting browser Firefox
30 03 2017 04:27:58.925:ERROR [launcher]: Cannot start Firefox
	XPCOMGlueLoad error for file /docker/vendor/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

30 03 2017 04:27:58.930:INFO [launcher]: Trying to start Firefox again (1/2).
30 03 2017 04:27:58.941:ERROR [launcher]: Cannot start Firefox
	XPCOMGlueLoad error for file /docker/vendor/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

30 03 2017 04:27:58.943:INFO [launcher]: Trying to start Firefox again (2/2).
30 03 2017 04:27:58.959:ERROR [launcher]: Cannot start Firefox
	XPCOMGlueLoad error for file /docker/vendor/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

30 03 2017 04:27:58.964:ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
npm ERR! Test failed.  See above for more details.

Here's a relevant gist to explore this for yourself:

https://gist.github.com/twolfson/f099e18cf5eb9cc55384e7a0582fbe10

twolfson/karma-electron#22 (comment)

@dignifiedquire
Copy link
Member

Nice, I have seen a few bug reports where this was an issue. Could you add an e2e test with a fake launcher that prints something to stderr so we have a test of making sure this works as expected?

@twolfson
Copy link
Contributor Author

Sure thing. After some browsing, it looks like karma-script-launcher and test/e2e/timeout are a great starting point. It's a good thing e2e only runs in Linux, otherwise we'd have .cmd/.bat issues to worry about in Windows x_x

@twolfson twolfson force-pushed the dev/better.launch.fail.errors.sqwished branch from bc98979 to 7d33398 Compare March 30, 2017 08:38
@twolfson
Copy link
Contributor Author

Alright, I've added the test in e2e 👍

@dignifiedquire
Copy link
Member

Thank you :octocat:

@dignifiedquire dignifiedquire merged commit 3263c06 into karma-runner:master Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants