Closed smspillaz closed 9 years ago
Also just wanted to leave a note here, so that it doesn't end up in the commit message by accident - I really like what you've done with this tool :) The tap output in autotools' parallel-tests runner looks great and the formatted output looks even better.
Thank you very much! I made a small modification (added a comment so code didn't get accidentally added after the last statement) and merged it manually.
Some test runners (eg, run-js-tests in gnome-shell) need to embed the jasmine wrapper script and call it through gjs_context_eval. Calling System.exit will prematurely terminate those runners. This prevents things like garbage collection or coverage statistics write-outs from occurring.
A not-so-well publicised detail of JS_EvaluateScript is that "return code" parameter is set to the value of the very last expression statement in the script [1]. In this case, that is the code of Command.run, which is passed to System.exit. As such, we can rely on that behaviour to set the exit code and test runners will do the right thing and abort.
As for the normal GJS console - it won't abort straight away, but it will return this value.
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS::Evaluate