From 540d5b9ca3f58ee5ce3bdbc59de80f1ebfe58e6c Mon Sep 17 00:00:00 2001 From: Matthew Beasley Date: Mon, 12 May 2014 21:56:33 +0100 Subject: [PATCH 1/8] Update runner.js --- phantomjs/runner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/phantomjs/runner.js b/phantomjs/runner.js index dfec7b2..9f68891 100644 --- a/phantomjs/runner.js +++ b/phantomjs/runner.js @@ -32,6 +32,7 @@ phantomcss.init({ screenshotRoot: args.screenshots, failedComparisonsRoot: args.failures, libraryRoot: phantomCSSPath, // Give absolute path, otherwise PhantomCSS fails + mismatchTolerance: args.mismatchTolerance, onFail: function(test) { sendMessage('onFail', test); From fa2ef918c47cca9d5452c17e6b0a4710435073cb Mon Sep 17 00:00:00 2001 From: Matthew Beasley Date: Mon, 12 May 2014 21:57:21 +0100 Subject: [PATCH 2/8] Update phantomcss.js --- tasks/phantomcss.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/phantomcss.js b/tasks/phantomcss.js index 6a534e8..c4b4db3 100644 --- a/tasks/phantomcss.js +++ b/tasks/phantomcss.js @@ -21,7 +21,8 @@ module.exports = function(grunt) { screenshots: 'screenshots', results: 'results', viewportSize: [1280, 800], - logLevel: 'error' + logLevel: 'error', + mismatchTolerance: 0.05 }); // Timeout ID for message checking loop From bd7e1423708ed3c91627e13def037591f8e459d4 Mon Sep 17 00:00:00 2001 From: Paul Touhey Date: Wed, 16 Jul 2014 13:52:04 +0100 Subject: [PATCH 3/8] Update to Package.json to resolve dependancy issue with bower. --- bower.json | 6 ++++-- package.json | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index b95a60e..5f0b17a 100644 --- a/bower.json +++ b/bower.json @@ -27,6 +27,8 @@ "tests" ], "dependencies": { - "phantomcss": "f0846511d9e1e55aa160aaab84e2a150bd3a5a41" - } + "phantomcss": "f0846511d9e1e55aa160aaab84e2a150bd3a5a41", + "tmp": "0.0.23", + "bower": "1.3.6" + }, } diff --git a/package.json b/package.json index 01e9f2e..06b31b7 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "grunt": "~0.4.1" }, "dependencies": { - "bower": "~1.0.3", + "tmp": "0.0.23", + "bower": "1.3.6", "temporary": "0.0.7" }, "peerDependencies": { From 17be1e3d88cfca49abff28de5c038345328cdf7a Mon Sep 17 00:00:00 2001 From: Paul Touhey Date: Wed, 16 Jul 2014 13:55:43 +0100 Subject: [PATCH 4/8] Revert "Update to Package.json to resolve dependancy issue with bower." This reverts commit bd7e1423708ed3c91627e13def037591f8e459d4. --- bower.json | 6 ++---- package.json | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 5f0b17a..b95a60e 100644 --- a/bower.json +++ b/bower.json @@ -27,8 +27,6 @@ "tests" ], "dependencies": { - "phantomcss": "f0846511d9e1e55aa160aaab84e2a150bd3a5a41", - "tmp": "0.0.23", - "bower": "1.3.6" - }, + "phantomcss": "f0846511d9e1e55aa160aaab84e2a150bd3a5a41" + } } diff --git a/package.json b/package.json index 06b31b7..01e9f2e 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,7 @@ "grunt": "~0.4.1" }, "dependencies": { - "tmp": "0.0.23", - "bower": "1.3.6", + "bower": "~1.0.3", "temporary": "0.0.7" }, "peerDependencies": { From 67f381b3624fbeb0f6d8d705a156ea52b4b516f0 Mon Sep 17 00:00:00 2001 From: Paul Touhey Date: Wed, 16 Jul 2014 14:09:07 +0100 Subject: [PATCH 5/8] Updated Package.json to Bower 1.3.8, disabling interactive mode to prevent prompts. --- .bowerrc | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.bowerrc b/.bowerrc index 44491d3..d188ca1 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,4 @@ { - "directory": "bower_components" + "directory": "bower_components", + "interactive": false } diff --git a/package.json b/package.json index 01e9f2e..47591f5 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "grunt": "~0.4.1" }, "dependencies": { - "bower": "~1.0.3", + "bower": "~1.3.8", "temporary": "0.0.7" }, "peerDependencies": { From 627cee1af4ebb927b7ae7dcc9b7f3166f5307374 Mon Sep 17 00:00:00 2001 From: Paul Touhey Date: Wed, 10 Dec 2014 11:37:42 +0000 Subject: [PATCH 6/8] Updated to remove bower dependancies and include phantomcss. --- .bowerrc | 4 ---- bower.json | 32 -------------------------------- package.json | 8 ++++---- tasks/phantomcss.js | 2 +- 4 files changed, 5 insertions(+), 41 deletions(-) delete mode 100644 .bowerrc delete mode 100644 bower.json diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index d188ca1..0000000 --- a/.bowerrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "directory": "bower_components", - "interactive": false -} diff --git a/bower.json b/bower.json deleted file mode 100644 index b95a60e..0000000 --- a/bower.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "grunt-phantomcss", - "version": "0.2.3", - "homepage": "https://github.com/chrisgladd/grunt-phantomcss", - "authors": [ - "Chris Gladd ", - "Larry Davis ", - "Aliaksei Sapach " - ], - "description": "A grunt task for phantomcss", - "keywords": [ - "grunt", - "phantomjs", - "phantomcss", - "css", - "regression", - "test", - "testing" - ], - "license": "MIT", - "private": true, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "phantomcss": "f0846511d9e1e55aa160aaab84e2a150bd3a5a41" - } -} diff --git a/package.json b/package.json index 47591f5..6039c16 100644 --- a/package.json +++ b/package.json @@ -29,17 +29,17 @@ "node": ">= 0.8.0" }, "scripts": { - "test": "grunt test", - "postinstall": "node ./node_modules/bower/bin/bower install" + "test": "grunt test" }, "devDependencies": { "grunt-contrib-jshint": "~0.6.0", "grunt-contrib-clean": "~0.4.0", "grunt-contrib-nodeunit": "~0.2.0", - "grunt": "~0.4.1" + "grunt": "~0.4.1", + "phantomjs": "~1.9.2-2" }, "dependencies": { - "bower": "~1.3.8", + "phantomcss": "0.3.0", "temporary": "0.0.7" }, "peerDependencies": { diff --git a/tasks/phantomcss.js b/tasks/phantomcss.js index c4b4db3..444c15a 100644 --- a/tasks/phantomcss.js +++ b/tasks/phantomcss.js @@ -11,7 +11,7 @@ var path = require('path'); var tmp = require('temporary'); var phantomBinaryPath = require('phantomjs').path; var runnerPath = path.join(__dirname, '..', 'phantomjs', 'runner.js'); -var phantomCSSPath = path.join(__dirname, '..', 'bower_components', 'phantomcss'); +var phantomCSSPath = path.join(__dirname, '..', 'node_modules', 'phantomcss'); module.exports = function(grunt) { grunt.registerMultiTask('phantomcss', 'CSS Regression Testing', function() { From 972b42cfcc829d0a7ffa93ce76e6a6ab0004b152 Mon Sep 17 00:00:00 2001 From: Paul Touhey Date: Wed, 10 Dec 2014 11:45:14 +0000 Subject: [PATCH 7/8] Update tolerance for test. --- tasks/phantomcss.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/phantomcss.js b/tasks/phantomcss.js index 444c15a..2447955 100644 --- a/tasks/phantomcss.js +++ b/tasks/phantomcss.js @@ -22,7 +22,7 @@ module.exports = function(grunt) { results: 'results', viewportSize: [1280, 800], logLevel: 'error', - mismatchTolerance: 0.05 + mismatchTolerance: 1.00 }); // Timeout ID for message checking loop From 7b8493f6925868b7b910ed629cedb657b19bf04b Mon Sep 17 00:00:00 2001 From: Paul Touhey Date: Fri, 24 Apr 2015 15:25:41 +0100 Subject: [PATCH 8/8] Failsafe for PhantomJS crashes. --- tasks/phantomcss.js | 50 ++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/tasks/phantomcss.js b/tasks/phantomcss.js index 2447955..9179c13 100644 --- a/tasks/phantomcss.js +++ b/tasks/phantomcss.js @@ -165,21 +165,37 @@ module.exports = function(grunt) { // Start watching for messages checkForMessages(); - grunt.util.spawn({ - cmd: phantomBinaryPath, - args: [ - runnerPath, - JSON.stringify(options) - ], - opts: { - cwd: cwd, - stdio: 'inherit' - } - }, function(error, result, code) { - // When Phantom exits check for remaining messages one last time - checkForMessages(true); + //FailSafe PhantomJS + var complete = this.async(); + var count = 0; + var retry = function () { + grunt.util.spawn({ + cmd: phantomBinaryPath, + args: [ + runnerPath, + JSON.stringify(options) + ], + opts: { + cwd: cwd, + stdio: 'inherit' + } + }, function (error, result, code) { + count++; + if (error && code === 1 /*error code thrown by when phantomjs fails*/) { + if(count < 8) { + grunt.log.writeln("Retrying phantomcss tests up to 7 times. Try: " + count); + retry(); + } else { + checkForMessages(true); + cleanup(error); + complete(false); + } + } else { + complete(result); + } + }); + }; + retry(); + }); +}; - cleanup(error); - }); - }); -};