Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Add semi linting rule
Browse files Browse the repository at this point in the history
Ok, ok…
  • Loading branch information
MattiSG committed Nov 23, 2015
1 parent fef0814 commit 4204d14
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/Watai.js
Expand Up @@ -38,7 +38,7 @@ var Watai = {
setup: require('./controller/SetupLoader'),
steps: require('./model/steps'),
matchers: require('./model/steps/state')
}
};


Watai.setup.reload(); // ensure setup is initialized at least once
Expand Down
2 changes: 1 addition & 1 deletion src/controller/Runner.js
Expand Up @@ -203,7 +203,7 @@ var Runner = new Class( /** @lends Runner# */ {
.then(this.loadBaseURL.bind(this))
.then(this.start.bind(this),
this.deferred.reject) // ensure failures in driver init are propagated
.finally(function() { return promise });
.finally(function() { return promise; });
},

/** Actually starts the evaluation process.
Expand Down
6 changes: 3 additions & 3 deletions src/controller/SuiteLoader.js
Expand Up @@ -217,7 +217,7 @@ var SuiteLoader = new Class( /** @lends SuiteLoader# */ {
loadAllFiles: function loadAllFiles(files) {
var scenarioFiles = {},
componentFiles = [],
ignoredScenariosIndices = this.config.ignore.map(function(index) { return String(index) }); // to allow comparison with parsed indices
ignoredScenariosIndices = this.config.ignore.map(function(index) { return String(index); }); // to allow comparison with parsed indices

files.forEach(function(file) {
var match; // if capturing parentheses are used in the file type detection regexp (see SuiteLoader.paths), this var holds the `match()` result
Expand Down Expand Up @@ -380,7 +380,7 @@ SuiteLoader.paths = {
/** If a file matches this RegExp, it is considered as a data suite to be loaded.
*/
fixtureMarker: /(.+)(Fixture|Data).js$/i // Data is kept for v<0.7 compatibility
}
};

/** Lists all predefined global variables in the suite loading context, and how they are referenced in that context.
*
Expand All @@ -399,7 +399,7 @@ SuiteLoader.contextGlobals = {
/** The name of the offered assertion library.
*/
assert: 'assert',
}
};


module.exports = SuiteLoader; // CommonJS export
6 changes: 3 additions & 3 deletions src/lib/Preprocessor.js
Expand Up @@ -6,7 +6,7 @@ var path = require('path');
*/
var Preprocessor = function Preprocessor(pluginsDir) {
this.pluginsDir = pluginsDir;
}
};

/** Loads plugins based on arguments passed to the main Node process.
*
Expand All @@ -17,7 +17,7 @@ Preprocessor.prototype.processArgv = function processArgv() {
var args = process.argv.slice(2); // extract CLI arguments, see http://docs.nodejitsu.com/articles/command-line/how-to-parse-command-line-arguments

return this.processAll(args);
}
};

/** Loads plugins based on any passed options.
* More precisely: any option prefixed with `--` will be recognized as a plugin, and if a matching file is found, the corresponding argument will be removed from the passed in array.
Expand Down Expand Up @@ -70,7 +70,7 @@ Preprocessor.prototype.processAll = function processAll(args) {
}

return result;
}
};


module.exports = Preprocessor; // CommonJS export
14 changes: 7 additions & 7 deletions src/lib/cli-animator-posix.js
Expand Up @@ -18,32 +18,32 @@ CLIanimator.log = function log(prefix, type, message, messageType, out) {

stop();
out.write(makeLine(prefix, typeToColorCode[type], message + '\n', typeToColorCode[messageType]));
}
};

/** Erases the current line.
*/
CLIanimator.clear = function clear() {
process.stdout.write('\r');
}
};

/** Hides the cursor.
*/
CLIanimator.hideCursor = function hideCursor() {
process.stdout.write('\033[?25l');
}
};

/** Shows the cursor.
*/
CLIanimator.showCursor = function showCursor() {
process.stdout.write('\033[?25h');
}
};

/** Does a spinner animation with the given message.
*/
CLIanimator.spin = function spin(message) {
stop();
play(makeFrames(message));
}
};

/** Creates a coloured line out of the given pieces.
*@return String
Expand All @@ -66,7 +66,7 @@ function makeFrames(msg) {
makeLine('◞', 96, msg, 90),
makeLine('◡', 96, msg, 90),
makeLine('◟', 96, msg, 90)
]
];
}

/** Maps types to the corresponding ANSI color code.
Expand All @@ -83,7 +83,7 @@ var typeToColorCode = {
yellow : 33,
grey : 90,
gray : 90
}
};

/** Plays the given array of strings.
*@private
Expand Down
10 changes: 5 additions & 5 deletions src/lib/cli-animator-windows.js
Expand Up @@ -16,32 +16,32 @@ var logger = require('winston');
*/
WindowsCLI.log = function log(prefix, type, message, messageType) {
logger[method](prefix + ' ' + message);
}
};

/** Erases the current line.
*/
WindowsCLI.clear = function clear() {
process.stdout.write('\r');
}
};

/** Hides the cursor.
* Does nothing on Windows.
*/
WindowsCLI.hideCursor = function hideCursor() {
// do nothing on Windows
}
};

/** Shows the cursor.
* Does nothing on Windows.
*/
WindowsCLI.showCursor = function showCursor() {
// do nothing on Windows
}
};

/** Logs the given message.
*/
WindowsCLI.spin = function spin(message) {
logger.verbose(message);
}
};

module.exports = WindowsCLI; // CommonJS export
10 changes: 5 additions & 5 deletions src/model/Component.js
Expand Up @@ -41,15 +41,15 @@ var Component = new Class( /** @lends Component# */ {
// however, when wrapping these names, we can't assign to a Function's name, and dynamically creating its name means creating it through evaluation, which means we'd first have to extract its arguments' names, which is getting very complicated
var action = function() {
return method.apply(component, args);
}
};

action.component = component;
action.reference = key;
action.title = method.name;
action.args = args;

return action;
}
};
});
},

Expand Down Expand Up @@ -104,15 +104,15 @@ var Component = new Class( /** @lends Component# */ {
return component[key].then(function(element) {
return element[method].apply(element, args);
});
}
};

action.component = component;
action.reference = basename;
action.title = basename;
action.args = args;

return action;
}
};
});
},

Expand All @@ -137,6 +137,6 @@ var Component = new Class( /** @lends Component# */ {
*/
Component.magic = {
click: /(.+)(Link|Button|Checkbox|Option|Radio)$/i
}
};

module.exports = Component; // CommonJS export
12 changes: 6 additions & 6 deletions src/model/Locator.js
Expand Up @@ -13,7 +13,7 @@ var WATAI_SELECTOR_TYPES_TO_WEBDRIVER_TYPES = {
name : 'name',
'class' : 'class name',
tag : 'tag name'
}
};

/** Default Watai selector type
*
Expand Down Expand Up @@ -45,7 +45,7 @@ var Locator = function Locator(locator, driver) {
*/
this.toSeleniumElement = function toSeleniumElement() {
return this.driver.element(WATAI_SELECTOR_TYPES_TO_WEBDRIVER_TYPES[this.type] || this.type, this.selector);
}
};

/** Sends the given sequence of keystrokes to the element pointed by this locator.
*
Expand All @@ -65,8 +65,8 @@ var Locator = function Locator(locator, driver) {
}).then(function() {
return element; // allow easier chaining
});
}
}
};
};

/** Adds a getter and a setter to the given Object, allowing access to the Selenium element corresponding to the given locator description.
* The getter dynamically retrieves the Selenium element pointed at by the given selector description.
Expand All @@ -84,7 +84,7 @@ Locator.addLocator = function addLocator(target, key, typeAndSelector, driver) {
target.emit('action', key, 'write', [ input ]);

return locator.handleInput(input);
}
};

var propertyDescriptor = {};

Expand All @@ -110,6 +110,6 @@ Locator.addLocator = function addLocator(target, key, typeAndSelector, driver) {

return setter;
};
}
};

module.exports = Locator; // CommonJS export
2 changes: 1 addition & 1 deletion src/model/steps/index.js
Expand Up @@ -7,6 +7,6 @@
var steps = {
FunctionalStep: require('./FunctionalStep'),
StateStep: require('./StateStep')
}
};

module.exports = steps;
4 changes: 2 additions & 2 deletions src/model/steps/state/index.js
Expand Up @@ -9,7 +9,7 @@ var matchers = {
ContentMatcher : require('./ContentMatcher'),
ContentRegExpMatcher: require('./ContentRegExpMatcher'),
FunctionMatcher : require('./FunctionMatcher')
}
};

/** Returns the matcher class that is able to test for the given expected value.
*
Expand All @@ -25,6 +25,6 @@ matchers.forValue = function matcherForValue(expected) {
return matchers.ContentRegExpMatcher;
else if (typeof expected == 'string')
return matchers.ContentMatcher;
}
};

module.exports = matchers;
4 changes: 2 additions & 2 deletions src/view/PromiseView.js
Expand Up @@ -60,15 +60,15 @@ var PromiseView = new Class(/** @lends PromiseView# */{
userDisplayable = {
title: lines.shift(),
help: lines.join('\n')
}
};
}

return {
title: userDisplayable.title, // no default value: this is how a client can know if a detailed description was found; don't try putting `error.toString()`: some values do _not_ have a toString() method
help: (userDisplayable.help ? userDisplayable.help + '\n' : '')
+ 'Get more help at <https://github.com/MattiSG/Watai/wiki/Troubleshooting>',
source: error
}
};
},

/** Presents details of a test start to the user.
Expand Down
2 changes: 1 addition & 1 deletion src/view/Runner/Dots.js
Expand Up @@ -94,6 +94,6 @@ var getDurationString = function getDurationString(first, second) {
});

return result.trim();
}
};

module.exports = RunnerDots; // CommonJS export
6 changes: 3 additions & 3 deletions test/unit/controller/RunnerTest.js
Expand Up @@ -65,7 +65,7 @@ describe('Runner', function() {
scenarioEvaluationCount = 0;

var scenario = new Watai.Scenario('RunnerTest scenario', [
function() { scenarioEvaluationCount++ }
function() { scenarioEvaluationCount++; }
], {}, require('../../config'));

var failingScenario = new Watai.Scenario('RunnerTest failing scenario', [
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('Runner', function() {
it('should return a promise', function(done) {
this.timeout(config.browserWarmupTime);

subject.test().done(function() { done() });
subject.test().done(function() { done(); });
});

it('should evaluate scenarios once', function(done) {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('Runner', function() {
it('should not forbid a proper second run', function(done) {
this.timeout(config.browserWarmupTime);

subject.test().done(function() { done() }, done);
subject.test().done(function() { done(); }, done);
});
});

Expand Down
8 changes: 4 additions & 4 deletions test/unit/helpers/StdoutSpy.js
Expand Up @@ -26,15 +26,15 @@ process.stdout.write = (function(write) {
*/
exports.reset = function reset() {
buffer = '';
}
};

/** Returns what would have been printed while muted.
*
*@returns {String}
*/
exports.printed = function printed() {
return buffer;
}
};

/** Tells whether `stdout.write` was called since the last call to `reset`.
*
Expand All @@ -48,10 +48,10 @@ exports.called = function called() {
*/
exports.mute = function mute() {
suspend = true;
}
};

/** Allows `stdout` output.
*/
exports.unmute = function unmute() {
suspend = false;
}
};
4 changes: 2 additions & 2 deletions test/unit/helpers/driver.js
Expand Up @@ -65,7 +65,7 @@ function openDriverWithin(destination) {
destination.driver = driver;
done();
}
}
};
}

/** Creates a new WebDriver instance and loads the `baseURL` found in the loaded config, calling back when it is ready.
Expand Down Expand Up @@ -111,7 +111,7 @@ function closeDriverWithin(source) {
source.driver.quit().done(done);
else
done();
}
};
}


Expand Down

0 comments on commit 4204d14

Please sign in to comment.