-
Notifications
You must be signed in to change notification settings - Fork 258
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
slimer.exit() should be able to set exit status #50
Comments
This is a known issue. As indicated in API_COMPAT, there is no way in the mozilla platform to set the exit status. So the exit() parameter is ignored for the moment. |
A workaround for your script is to display (console.log) an error message and a rule in the CI server could check if the output contains this message or not. |
I don't know a lot about how this stuff works, but the SpiderMonkey shell supports For now, I can make my test tools emit TAP and pipe into something that knows what that means, so this isn't a show-stopper. |
I don't use the spidermonkey shell. SpiderMonkey is only a javascript engine. It does not contain a rendering engine, it does not provide a DOM API, an API to manipulate files, an API to do networking etc. SpiderMonkey is only a tiny part of a browser, a tiny part of Gecko. SlimerJS is built on top the Mozilla platform (Gecko/XulRunner), like Firefox. In future version, probably SlimerJS will embed directly the Mozilla platform, so we could patch it to provide missing features. |
Possible solution for a patch on gecko for a future version of SlimerJS:
It should be enough. |
A WIP patch does exist https://bugzilla.mozilla.org/show_bug.cgi?id=894697 |
I think it could be achieve it without changes in the Gecko. Since slimerjs is launched via shell script, you can use nsIEnvironment https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIEnvironment to set var for the current process in the phantom/slimer.exit() and then exit from the shell with the value of that var. The above solution will not work, because the xulrunner is run in its own shell. For now the solution which would work is to write status file in the profile dir and get the exit status from that file after xulrunner has finished. |
@abozhilov yes I thought about a solution like that, but I found it is was an ugly hack. However, since we can't wait after Mozilla and many projects depends on it, I'm ok to implement this solution. |
So now we have a workaround for the exit code, thanks to @abozhilov . |
Can we close this issue now that #278 has been merged? |
Currently (version 0.7) calling
slimer.exit(1)
makes the process exit with status0
. This makes Slimer unsuitable for use as a testing platform since CI servers cannot tell whether the tests failed without relying on a special output format like TAP or XML.It should be possible to write test scripts with Slimer and use the exit status to indicate failure.
The text was updated successfully, but these errors were encountered: