From de148e98f01f02cfdb072ed759e2af9def418a6b Mon Sep 17 00:00:00 2001 From: Kelly Miyashiro Date: Wed, 20 Nov 2013 17:37:10 -0800 Subject: [PATCH] Cleanup, spacing --- example/test/test2.html | 1 - phantomjs/bridge.js | 51 +++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/example/test/test2.html b/example/test/test2.html index bb9841f..453ae52 100644 --- a/example/test/test2.html +++ b/example/test/test2.html @@ -37,7 +37,6 @@ // Can alternatively do a check on window.PHANTOMJS if (navigator.userAgent.indexOf('PhantomJS') < 0) { mocha - // .globals(['Wombat', 'Apple']) // acceptable globals .run(); } diff --git a/phantomjs/bridge.js b/phantomjs/bridge.js index 382d362..83c56f1 100644 --- a/phantomjs/bridge.js +++ b/phantomjs/bridge.js @@ -18,7 +18,6 @@ // Create a listener who'll bubble events from Phantomjs to Grunt function createGruntListener(ev, runner) { - runner.on(ev, function(test, err) { var data = { err: err @@ -32,7 +31,6 @@ } sendMessage('mocha.' + ev, data); - }); } @@ -60,7 +58,8 @@ 'end' ]; - for(var i = 0; i < events.length; i++) { + for (var i = 0; i < events.length; i++) { + console.log('created listener for', events[i]); createGruntListener(events[i], runner); } @@ -71,35 +70,31 @@ GruntReporter.prototype = new Klass(); var options = window.PHANTOMJS; + // Default mocha options + var config = { + ui: 'bdd', + ignoreLeaks: true, + reporter: GruntReporter + }, + run = options.run, + key; + if (options) { - // Default mocha options - var config = { - ui: 'bdd', - ignoreLeaks: true, - reporter: GruntReporter - }, - run = options.run, - key; - - if (options) { - // If options is a string, assume it is to set the UI (bdd/tdd etc) - if (typeof options === "string") { - config.ui = options; - } else { - // Extend defaults with passed options - for (key in options.mocha) { - config[key] = options.mocha[key]; - } + // If options is a string, assume it is to set the UI (bdd/tdd etc) + if (typeof options === "string") { + config.ui = options; + } else { + // Extend defaults with passed options + for (key in options.mocha) { + config[key] = options.mocha[key]; } } + } - config.reporter = GruntReporter; - - mocha.setup(config); + mocha.setup(config); - // task option `run`, automatically runs mocha for grunt only - if (run) { - mocha.run(); - } + // task option `run`, automatically runs mocha for grunt only + if (run) { + mocha.run(); } }());