Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix minor] A couple of minor whitespace updates. Fixed bin/kyuri to …

…use relative path
  • Loading branch information...
commit a6804bfe9b6a65fc734b01bb71dcfed20945cdd2 1 parent ac59608
Charlie Robbins indexzero authored
50 bin/kyuri
View
@@ -9,14 +9,14 @@ stepsDirs = ['steps', 'step_definitions'];
envDirs = ['support'];
var inspect = require('eyes').inspector({
- stream: null,
- styles: { string: 'grey', regexp: 'grey' }
+ stream: null,
+ styles: { string: 'grey', regexp: 'grey' }
});
-var kyuri = require('kyuri');
+var kyuri = require('../lib/kyuri');
var help = [
- "usage: kyuri [FILE, ...]"
+ "usage: kyuri [FILE, ...]"
].join('\n');
var root = process.cwd();
@@ -30,27 +30,27 @@ var _loadJavascripts = function (directory, steps) {
directory = path.join(root, directory);
}
- if(path.existsSync(directory)) {
+ if (path.existsSync(directory)) {
var files = fs.readdirSync(directory);
files.forEach(function (file) {
var fullPath = path.join(directory, file),
- stats = fs.statSync(fullPath),
- exported;
+ stats = fs.statSync(fullPath),
+ exported;
if (stats.isDirectory()) {
- _loadJavascripts(fullPath, steps);
- } else {
- if (file.match(/\.js$/)) {
- // Add root to all relative paths
- if (!fullPath.match(/^\//)) {
- fullPath = path.join(root, fullPath);
- }
- exported = require(fullPath);
- if (exported && exported.forEach && steps) {
- exported.forEach(function (obj) {
- steps.push(obj); // Pass-by-reference array must be modified in place
- })
- }
+ return _loadJavascripts(fullPath, steps);
+ }
+
+ if (file.match(/\.js$/)) {
+ // Add root to all relative paths
+ if (!fullPath.match(/^\//)) {
+ fullPath = path.join(root, fullPath);
+ }
+ exported = require(fullPath);
+ if (exported && exported.forEach && steps) {
+ exported.forEach(function (obj) {
+ steps.push(obj); // Pass-by-reference array must be modified in place
+ })
}
}
});
@@ -77,7 +77,8 @@ argv.forEach(function (file) {
// Add the path
files[i] = path.join(file, files[i]);
}
- } else {
+ }
+ else {
files = [file];
}
@@ -111,11 +112,13 @@ try {
kyuri.runners.cucumber.run(features, steps, function () {
complete = true;
});
-} catch (err) {
+}
+catch (err) {
console.log('Errors');
if (err.stack) {
console.log(err.stack);
- } else {
+ }
+ else {
console.log(err);
}
complete = true;
@@ -126,4 +129,5 @@ var _waitComplete = function () {
process.nextTick(_waitComplete);
}
};
+
_waitComplete();
2  lib/kyuri/lexer.js
View
@@ -202,7 +202,7 @@ Lexer.prototype = {
// If the comment is at the beginning of the chunk
// then evaluate it normally
- if(this.chunk.indexOf('#') === 0) {
+ if (this.chunk.indexOf('#') === 0) {
this.i += match[0].length;
this.token('COMMENT', match[1].trim());
return true;
4 lib/kyuri/parser.js
View
@@ -321,7 +321,7 @@ var _states = {
var scenario = getLastScenario(ast),
example;
- if(!scenario.hasExamples) {
+ if (!scenario.hasExamples) {
scenario.examples = [];
scenario.exampleVariables = token[1];
scenario.hasExamples = true;
@@ -432,7 +432,7 @@ Parser.prototype = {
// transition, do so now.
if (typeof transition.build === 'function') {
var built = transition.build(this.ast, token, this.node);
- if(typeof built !== 'undefined') {
+ if (typeof built !== 'undefined') {
this.node = built;
}
}
12 lib/kyuri/runners/cucumber.js
View
@@ -6,11 +6,11 @@
*
*/
var kyuri = require('../../kyuri'),
- fs = require('fs'),
- util = require('util'),
- colors = require('colors'),
- lingo = require('lingo'),
- EventEmitter = require('events').EventEmitter;
+ fs = require('fs'),
+ util = require('util'),
+ colors = require('colors'),
+ lingo = require('lingo'),
+ EventEmitter = require('events').EventEmitter;
var log = console.log;
@@ -219,7 +219,7 @@ Cucumber.prototype._printMissingSteps = function () {
matches = pattern.match(/\([^)]*\)/g);
if (matches) {
- for(var i = 0; i < matches.length; i++) {
+ for (var i = 0; i < matches.length; i++) {
args.push('arg' + (i + 1));
}
}
8 lib/kyuri/runners/vows.js
View
@@ -18,7 +18,7 @@ var vows = require('vows'),
//
var mergingTopic = function (step, text, topics) {
var match, topic = {};
- if(!(match = step.pattern.match(text))) {
+ if (!(match = step.pattern.match(text))) {
return;
}
@@ -57,7 +57,9 @@ exports.createVows = function (filename, features) {
exports.scenarioVows = function (scenario) {
// Create root context, and set current context to it.
- var context = {}, current = context, then = false;
+ var context = {},
+ current = context,
+ then = false;
if (scenario.outline) {
// If the scenario is a 'Scenario Outline'
@@ -70,7 +72,7 @@ exports.scenarioVows = function (scenario) {
text = breakdown.join(' ');
// Remark: i18n compatibility here
- if(breakdown[0] === 'THEN') {
+ if (breakdown[0] === 'THEN') {
then = true;
}
10 lib/kyuri/steps.js
View
@@ -24,11 +24,11 @@ exports.When = function (pattern, topicGenerator) {
};
exports.And = function (pattern, topicGenerator) {
- steps.push({
- operator: 'And',
- pattern: pattern,
- generator: topicGenerator
- });
+ steps.push({
+ operator: 'And',
+ pattern: pattern,
+ generator: topicGenerator
+ });
};
exports.Then = function (pattern, callbackGenerator) {
Please sign in to comment.
Something went wrong with that request. Please try again.