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

Already on GitHub? Sign in to your account

Phantomjs Headless Runner #1

Merged
merged 61 commits into from Sep 5, 2013

Conversation

Projects
None yet
2 participants
Owner

wireframe commented Feb 28, 2013

Remove jasmine-headless-webkit runner (which is unmaintained) in favor of PhantomJS runner.

Asset Pipeline

Full integration into asset pipeline and 100% reuse between "in browser" and "headless" experiences.

Browser Testing

http://myserver.local/jasmine is a Rails engine that can be used to run the javascript testsuite locally

CLI/Headless Testing

rake spec:javascript runs the javascript testsuite with a headless webkit instance via PhantomJS. The testsuite can be filtered by using the SPEC option. ex: rake spec:javascript SPEC=my_test_case

wireframe added some commits Feb 25, 2013

@wireframe wireframe remove jasmine-headless-webkit dependency 002efe8
@wireframe wireframe add filter for specific spec 2ed290d
@wireframe wireframe add headless mode for jasmine tests fdb691f
@wireframe wireframe fix overwriting local assets 662fa7a
@wireframe wireframe support spec query param e3374b9
@wireframe wireframe add support for console helpers 747ec7b
@wireframe wireframe add phantom runner 9c434cc
@wireframe wireframe add runner dependencies 6d5b5b4
@wireframe wireframe add runner dependencies 6146bb4
@wireframe wireframe use relative path for headless runner 6554419
@wireframe wireframe rename rake task 721306e
@wireframe wireframe move class out of rake task 8033fd9
@wireframe wireframe inline console config into runner 39459c0
@wireframe wireframe update readme 24ed754
@wireframe wireframe reuse existing jasmine boot js fdc6da4
@wireframe wireframe add alias rake task 791800b
@wireframe wireframe remove console_helpers config ca19463
@wireframe wireframe manually build asset for specs to filter out duplicate dependencies 66fe666
@wireframe wireframe support clientside filtering of specs for phantom runner 91d3632
@wireframe wireframe use jsApiReporter interface for phantom runner b45fbfd
@wireframe wireframe avoid printing skipped specs a51ca17
@wireframe wireframe delay exit for last reporter output 554144f
@wireframe wireframe fix double include issue for console runner e413f49
@wireframe wireframe remove unused config 25dd5b4
@wireframe wireframe remove js output ac1b24c
@wireframe wireframe update docs 207e6d2
@wireframe wireframe only depend on jasmine-core e95d3ad
@wireframe wireframe remove headless dependency 024c283
@wireframe wireframe bump local version 3f0c3dd
@wireframe wireframe disable offline asset path after complete to prevent stomping on futu…
…re executions
6a64aab
@wireframe wireframe bump version 51b05f4
@wireframe wireframe bump version 806ef7c

@MoonScript MoonScript commented on an outdated diff Feb 28, 2013

lib/assets/javascripts/jasmine-boot.js
+ jasmineEnv.addReporter(htmlReporter);
+ jasmineEnv.specFilter = function(spec) {
+ return htmlReporter.specFilter(spec);
+ };
+
+ if (jasmine.ConsoleReporter) {
+ jasmineEnv.addReporter(new jasmine.ConsoleReporter());
+ }
+
+ var currentWindowOnload = window.onload;
+ window.onload = function() {
+ if (currentWindowOnload) {
+ currentWindowOnload();
+ }
+ execJasmine();
+ };
@MoonScript

MoonScript Feb 28, 2013

I'd vote for this approach for attaching your onload-handler:

if (window.addEventListener) { // W3C
  window.addEventListener('load', execJasmine, false);
} else if (window.attachEvent) { // MSIE
  window.attachEvent('onload', execJasmine);
}

@MoonScript MoonScript commented on an outdated diff Feb 28, 2013

lib/tasks/runner.js
@@ -0,0 +1,65 @@
+var errorHandler = function(msg, trace) {
@MoonScript

MoonScript Feb 28, 2013

I know some of these might not be your code, but this should definitely be wrapped in an anonymous self-executing function to keep these variables local.

@wireframe wireframe merged commit f66afcb into master Sep 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment