Skip to content

Commit

Permalink
fixed some jshint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed May 9, 2014
1 parent d0788e3 commit d9abec7
Show file tree
Hide file tree
Showing 5 changed files with 336 additions and 11 deletions.
20 changes: 12 additions & 8 deletions bin/_clirunner.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var Runner = require('../lib/runner/run.js');
var Logger = require('../lib/util/logger.js');
var Selenium = require('../lib/runner/selenium.js');
var util = require('util');
var fs = require('fs');
var path = require('path');
var util = require('util');

var SETTINGS_DEPRECTED_VAL = './settings.json';

Expand All @@ -30,7 +30,7 @@ CliRunner.prototype = {
* Read the provided config json file; defaults to settings.json if one isn't provided
*/
readSettings : function() {
// use default settings.json file if we haven't received another value
// use default nightwatch.json file if we haven't received another value
if (this.cli.command('config').isDefault(this.argv.c)) {
var defaultValue = this.cli.command('config').defaults();
var deprecatedValue = SETTINGS_DEPRECTED_VAL;
Expand All @@ -48,15 +48,15 @@ CliRunner.prototype = {
}
}
} else {
this.argv.c = path.resolve(argv.c);
this.argv.c = path.resolve(this.argv.c);
}

// reading the settings file
try {
this.settings = require(this.argv.c);
this.replaceEnvVariables();
this.manageSelenium = !this.isParallelMode() && this.settings.selenium &&
this.settings.selenium.start_process;
this.settings.selenium.start_process || false;
if (typeof this.settings.src_folders == 'string') {
this.settings.src_folders = [this.settings.src_folders];
}
Expand Down Expand Up @@ -258,6 +258,9 @@ CliRunner.prototype = {
},

inheritFromDefaultEnv : function() {
if (this.argv.e == 'default') {
return;
}
var defaultEnv = this.settings.test_settings['default'] || {};
for (var key in defaultEnv) {
if (typeof this.test_settings[key] == 'undefined') {
Expand Down Expand Up @@ -322,7 +325,7 @@ CliRunner.prototype = {
this.test_settings.silent = false;
}

this.test_settings.output = this.test_settings.output || typeof this.test_settings.output === 'undefined';
this.test_settings.output = this.test_settings.output || typeof this.test_settings.output == 'undefined';

if (typeof this.argv.s == 'string') {
this.test_settings.skipgroup = this.argv.s.split(',');
Expand Down Expand Up @@ -405,7 +408,7 @@ CliRunner.prototype = {
var args = [];
for (var i = 2; i < process.argv.length; i++) {
if (process.argv[i] == '-e' || process.argv[i] == '--env') {
i++
i++;
} else {
args.push(process.argv[i]);
}
Expand All @@ -424,7 +427,8 @@ CliRunner.prototype = {
finishCallback = finishCallback || function() {};

var availColors = [
['red', 'light_gray'], ['green', 'black'], ['blue', 'light_gray'], ['magenta', 'light_gray']];
['red', 'light_gray'], ['green', 'black'], ['blue', 'light_gray'], ['magenta', 'light_gray']
];
var currentIndex = availColors.length, temporaryValue, randomIndex;

// While there remain elements to shuffle...
Expand All @@ -439,7 +443,7 @@ CliRunner.prototype = {
}

var writeToSdtout = function(data, item, index) {
data = data.replace(/^\s+|\s+$/g, "");
data = data.replace(/^\s+|\s+$/g, '');
var color_pair = availColors[index%4];
process.stdout.write(Logger.colors[color_pair[1]]('[' + item + ']', Logger.colors.background[color_pair[0]]) + '\t' + data + '\n');
};
Expand Down
2 changes: 1 addition & 1 deletion lib/runner/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ module.exports = new (function() {

moduleName = moduleName.replace(/(_|\.)*([A-Z]*)/g, function(match, $0, $1, offset, string) {
if (!match) {
return ''
return '';
}
return (offset > 0 && (string.charAt(offset-1) != ' ') ? ' ':'') + $1;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/runner/selenium.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = new (function() {

util.print(Logger.colors.light_purple('Starting selenium server' + (settings.parallelMode ? ' in parallel mode' : '') +'... '));

if (typeof settings.selenium.cli_args == "object") {
if (typeof settings.selenium.cli_args == 'object') {
var cli_args = settings.selenium.cli_args;
for (var keyName in cli_args) {
if (cli_args[keyName]) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"jscoverage": "latest",
"coveralls": "latest",
"jshint": "~2.4.4",
"mock-spawn": "^0.2.1"
"mock-spawn": "^0.2.1",
"mockery": "^1.4.0"
},
"bin": {
"nightwatch": "./bin/nightwatch"
Expand Down
Loading

0 comments on commit d9abec7

Please sign in to comment.