From 872bf0fdfc0551eacbcb73b891d49e7cfafab277 Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Fri, 24 Apr 2015 15:44:01 -0400 Subject: [PATCH 1/2] ESLint test/*.js --- Gruntfile.js | 1 + tests/boomerang-test-framework.js | 8 ++++---- tests/builder.js | 28 +++++++++++++++++++--------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 135a94e89..a7dfce11d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -54,6 +54,7 @@ module.exports = function (grunt) { "tests/unit/*.js", "tests/e2e/*.js", "tests/server/*.js", + "tests/*.js", "tests/page-templates/**/*.js" ] }, diff --git a/tests/boomerang-test-framework.js b/tests/boomerang-test-framework.js index 8458d2187..5321cd9b9 100644 --- a/tests/boomerang-test-framework.js +++ b/tests/boomerang-test-framework.js @@ -22,7 +22,7 @@ page_ready: function() { this.fired_page_ready = true; }, - before_beacon: function(data) { + before_beacon: function() { }, onbeacon: function(data) { this.beacons.push(_.clone(data)); @@ -176,7 +176,7 @@ "h.d": "localhost", "h.t": new Date().getTime(), "h.cr": "abc" - }) + }); // setup Mocha window.mocha.globals(["BOOMR", "PageGroupVariable"]); @@ -193,7 +193,7 @@ } BOOMR.subscribe("onbeacon", function() { - if (++beaconsSeen == config.testAfterOnBeacon) { + if (++beaconsSeen === config.testAfterOnBeacon) { // wait a few more ms so the beacon fires // TODO: Trim this timing down if we can make it more reliable setTimeout(t.runTests, 1000); @@ -262,7 +262,7 @@ assert.isString(tf.lastBeacon().v); done(); - } + }; window.BOOMR_test = t; diff --git a/tests/builder.js b/tests/builder.js index ec9cd10d9..dcc4526fb 100644 --- a/tests/builder.js +++ b/tests/builder.js @@ -1,3 +1,4 @@ +/*eslint-env node*/ // // Imports // @@ -65,9 +66,6 @@ module.exports = function() { //make grunt know this task is async. var done = this.async(); - // options we'll be passing thru - var opts = {}; - async.waterfall([ // // First, load all static template variables @@ -120,11 +118,15 @@ module.exports = function() { var templateDir = dir.replace(testTemplatesDir + path.sep, ""); var supportDir = path.join(testTemplatesDir, templateDir, "support"); - rootIndexHtml += '

' + templateDir + '

'; + rootIndexHtml += "

" + templateDir + "

"; // copy support files over if (grunt.file.exists(supportDir)) { getFiles(supportDir, "", function(err, files) { + if (err) { + return cb2(err); + } + var supportDirDest = path.join(testPagesDir, templateDir, "support"); if (!grunt.file.exists(supportDirDest)) { @@ -144,6 +146,10 @@ module.exports = function() { // get all files for this dir getFiles(dir, ".html", function(err, files) { + if (err) { + return cb2(err); + } + var indexHtml = ""; var indexFile = path.join(testPagesDir, templateDir, "index.html"); var indexFileName = path.join(templateDir, "index.html"); @@ -182,8 +188,8 @@ module.exports = function() { // // Index.html // - indexHtml += '

' + templateFileName + '

'; - indexHtml += '\n' + indexHtml += "

" + templateFileName + "

"; + indexHtml += "\n"; // if the .js file exists, copy that too if (grunt.file.exists(jsFile)) { @@ -206,10 +212,14 @@ module.exports = function() { // test definitions grunt.file.write(e2eJsonPath, JSON.stringify(testDefinitions)); - cb(null, opts); + cb(err, opts); }); - }, - ], function(err, opts) { + } + ], function(err) { + if (err) { + console.log(err); + } + done(); }); }; From 63ad0dc03d20cff4a228b70e179c4a2bfffd7e69 Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Mon, 27 Apr 2015 14:50:07 -0400 Subject: [PATCH 2/2] Remove before_beacon test hook as it's not used --- tests/boomerang-test-framework.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/boomerang-test-framework.js b/tests/boomerang-test-framework.js index 5321cd9b9..5a89d2074 100644 --- a/tests/boomerang-test-framework.js +++ b/tests/boomerang-test-framework.js @@ -22,8 +22,6 @@ page_ready: function() { this.fired_page_ready = true; }, - before_beacon: function() { - }, onbeacon: function(data) { this.beacons.push(_.clone(data)); this.fired_onbeacon = true; @@ -44,7 +42,6 @@ } BOOMR.subscribe("page_ready", this.page_ready, null, this); - BOOMR.subscribe("before_beacon", this.before_beacon, null, this); BOOMR.subscribe("onbeacon", this.onbeacon, null, this); BOOMR.subscribe("before_unload", this.before_unload, null, this);