Commit 96e37bf1 96e37bf1d689c4acd740baa42c7ed52675eeac58 by Nicolas Perriault

refs #246 - jshint added to travis-ci build configuration

1 parent 2276b8d6
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
9 "maxdepth": 3, 9 "maxdepth": 3,
10 "maxstatements": 15, 10 "maxstatements": 15,
11 "maxcomplexity": 7, 11 "maxcomplexity": 7,
12 "proto": true,
12 "regexdash": true, 13 "regexdash": true,
13 "strict": true, 14 "strict": true,
14 "sub": true, 15 "sub": true,
......
...@@ -2,12 +2,13 @@ branches: ...@@ -2,12 +2,13 @@ branches:
2 only: 2 only:
3 - master 3 - master
4 before_script: 4 before_script:
5 - "npm install -g jshint"
5 - "phantomjs --version" 6 - "phantomjs --version"
6 - "export PHANTOMJS_EXECUTABLE='phantomjs --local-to-remote-url-access=yes --ignore-ssl-errors=yes'" 7 - "export PHANTOMJS_EXECUTABLE='phantomjs --local-to-remote-url-access=yes --ignore-ssl-errors=yes'"
7 - "export DISPLAY=:99.0"
8 - "sh -e /etc/init.d/xvfb start"
9 script: 8 script:
10 - "DISPLAY=:99.0 ./bin/casperjs selftest" 9 - "./bin/casperjs selftest"
10 after_script:
11 - "jshint --config=.jshintconfig ."
11 notifications: 12 notifications:
12 irc: 13 irc:
13 channels: 14 channels:
......
...@@ -926,6 +926,7 @@ Casper.prototype.getTitle = function getTitle() { ...@@ -926,6 +926,7 @@ Casper.prototype.getTitle = function getTitle() {
926 */ 926 */
927 Casper.prototype.handleReceivedResource = function(resource) { 927 Casper.prototype.handleReceivedResource = function(resource) {
928 "use strict"; 928 "use strict";
929 /*jshint maxstatements:20*/
929 if (resource.stage !== "end") { 930 if (resource.stage !== "end") {
930 return; 931 return;
931 } 932 }
...@@ -1109,6 +1110,7 @@ Casper.prototype.mouseEvent = function mouseEvent(type, selector) { ...@@ -1109,6 +1110,7 @@ Casper.prototype.mouseEvent = function mouseEvent(type, selector) {
1109 */ 1110 */
1110 Casper.prototype.open = function open(location, settings) { 1111 Casper.prototype.open = function open(location, settings) {
1111 "use strict"; 1112 "use strict";
1113 /*jshint maxstatements:30*/
1112 var baseCustomHeaders = this.page.customHeaders, 1114 var baseCustomHeaders = this.page.customHeaders,
1113 customHeaders = settings && settings.headers || {}; 1115 customHeaders = settings && settings.headers || {};
1114 this.checkStarted(); 1116 this.checkStarted();
...@@ -1297,6 +1299,7 @@ Casper.prototype.setHttpAuth = function setHttpAuth(username, password) { ...@@ -1297,6 +1299,7 @@ Casper.prototype.setHttpAuth = function setHttpAuth(username, password) {
1297 */ 1299 */
1298 Casper.prototype.start = function start(location, then) { 1300 Casper.prototype.start = function start(location, then) {
1299 "use strict"; 1301 "use strict";
1302 /*jshint maxstatements:30*/
1300 this.emit('starting'); 1303 this.emit('starting');
1301 this.log('Starting...', "info"); 1304 this.log('Starting...', "info");
1302 this.startTime = new Date().getTime(); 1305 this.startTime = new Date().getTime();
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
41 * Casper client-side helpers. 41 * Casper client-side helpers.
42 */ 42 */
43 exports.ClientUtils = function ClientUtils(options) { 43 exports.ClientUtils = function ClientUtils(options) {
44 /*jshint maxstatements:30*/
44 // private members 45 // private members
45 var BASE64_ENCODE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 46 var BASE64_ENCODE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
46 var BASE64_DECODE_CHARS = new Array( 47 var BASE64_DECODE_CHARS = new Array(
...@@ -200,6 +201,7 @@ ...@@ -200,6 +201,7 @@
200 * @return Object An object containing setting result for each field, including file uploads 201 * @return Object An object containing setting result for each field, including file uploads
201 */ 202 */
202 this.fill = function fill(form, vals) { 203 this.fill = function fill(form, vals) {
204 /*jshint maxcomplexity:8*/
203 var out = { 205 var out = {
204 errors: [], 206 errors: [],
205 fields: [], 207 fields: [],
...@@ -606,6 +608,7 @@ ...@@ -606,6 +608,7 @@
606 * @param mixed value The field value to set 608 * @param mixed value The field value to set
607 */ 609 */
608 this.setField = function setField(field, value) { 610 this.setField = function setField(field, value) {
611 /*jshint maxcomplexity:99 */
609 var logValue, fields, out; 612 var logValue, fields, out;
610 value = logValue = (value || ""); 613 value = logValue = (value || "");
611 if (field instanceof NodeList) { 614 if (field instanceof NodeList) {
......
...@@ -62,6 +62,7 @@ responseHeaders.prototype.get = function get(name){ ...@@ -62,6 +62,7 @@ responseHeaders.prototype.get = function get(name){
62 */ 62 */
63 exports.augmentResponse = function(response) { 63 exports.augmentResponse = function(response) {
64 "use strict"; 64 "use strict";
65 /*jshint proto:true*/
65 if (!utils.isHTTPResource(response)) { 66 if (!utils.isHTTPResource(response)) {
66 return; 67 return;
67 } 68 }
......
1 /*global casper*/ 1 /*global casper __utils__*/
2 /*jshint strict:false*/ 2 /*jshint strict:false*/
3 casper.start('tests/site/frames.html', function() { 3 casper.start('tests/site/frames.html', function() {
4 this.test.assertTitle('CasperJS test frames'); 4 this.test.assertTitle('CasperJS test frames');
......
...@@ -13,7 +13,7 @@ var t = casper.test, current = 0, tests = [ ...@@ -13,7 +13,7 @@ var t = casper.test, current = 0, tests = [
13 }, 13 },
14 function(request) { 14 function(request) {
15 t.assertNot(request.headers.some(testHeader), "Casper.open() custom headers option is not persistent"); 15 t.assertNot(request.headers.some(testHeader), "Casper.open() custom headers option is not persistent");
16 }, 16 }
17 ]; 17 ];
18 18
19 casper.on('page.resource.requested', function(request) { 19 casper.on('page.resource.requested', function(request) {
......
1 /*global casper*/ 1 /*global casper*/
2 /*jshint strict:false*/ 2 /*jshint strict:false maxstatements:99*/
3 var cli = require('cli'), t = casper.test; 3 var cli = require('cli'), t = casper.test;
4 4
5 t.comment('parse(), get(), has()'); 5 t.comment('parse(), get(), has()');
......