Skip to content

Commit

Permalink
[style] respect cloudhead's style
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Aug 5, 2011
1 parent dcf5021 commit c8ee815
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ function importSuites(files) {

function wrapSpawn(f) {
f = cwdname(f);
return function(options, callback) {
return function (options, callback) {
var args = [process.argv[1], '--json', '--supress-stdout', f],
p = spawn(process.argv[0], args),
result;

p.on('exit', function(code) {
p.on('exit', function (code) {
callback(
!result ?
{errored: 1, total: 1}
Expand All @@ -419,15 +419,15 @@ function importSuites(files) {
});

var buffer = [];
p.stdout.on('data', function(data) {
p.stdout.on('data', function (data) {
data = data.toString().split(/\n/g);
if (data.length == 1) {
buffer.push(data[0]);
} else {
data[0] = buffer.concat(data[0]).join('');
buffer = [data.pop()];

data.forEach(function(data) {
data.forEach(function (data) {
if (data) {
data = JSON.parse(data);
if (data && data[0] === 'finish') {
Expand Down
2 changes: 1 addition & 1 deletion lib/vows/reporters/dot-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var options = {},
var messages = [], lastContext;

this.name = 'dot-matrix';
this.setStream = function(s) {
this.setStream = function (s) {
options.stream = s;
};

Expand Down
2 changes: 1 addition & 1 deletion lib/vows/reporters/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var puts = console.puts(options);
// Console JSON reporter
//
this.name = 'json';
this.setStream = function(s) {
this.setStream = function (s) {
options.stream = s;
};
this.report = function (obj) {
Expand Down
2 changes: 1 addition & 1 deletion lib/vows/reporters/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var stylize = console.stylize,
//

this.name = 'spec';
this.setStream = function(s) {
this.setStream = function (s) {
options.stream = s;
};
this.report = function (data) {
Expand Down
2 changes: 1 addition & 1 deletion lib/vows/reporters/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var stylize = console.stylize,
var lastContext;

this.name = 'watch';
this.setStream = function(s) {
this.setStream = function (s) {
options.stream = s;
};
this.reset = function () {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/isolate/failing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ var vows = require('../../../lib/vows'),
var obvious;
vows.describe('failing').addBatch({
'Obvious test': obvious = {
topic: function() {
topic: function () {
this.callback(null, false);
},
'should work': function(result) {
'should work': function (result) {
assert.ok(result);
}
// but it won't
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/isolate/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ var vows = require('../../../lib/vows'),
var obvious;
vows.describe('stderr').addBatch({
'Obvious test': obvious = {
topic: function() {
topic: function () {
this.callback(null, true);
},
'should work': function(result) {
'should work': function (result) {
console.log('oh no!');
assert.ok(result);
}
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/isolate/passing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ var vows = require('../../../lib/vows'),
var obvious;
vows.describe('passing').addBatch({
'Obvious test': obvious = {
topic: function() {
topic: function () {
this.callback(null, true);
},
'should work': function(result) {
'should work': function (result) {
assert.ok(result);
}
},
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/isolate/stderr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ var vows = require('../../../lib/vows'),
var obvious;
vows.describe('stderr').addBatch({
'Obvious test': obvious = {
topic: function() {
topic: function () {
this.callback(null, true);
},
'should work': function(result) {
'should work': function (result) {
console.error('oh no!');
assert.ok(result);
}
Expand Down
24 changes: 12 additions & 12 deletions test/isolate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ var vows = require('../lib/vows'),
exec = require('child_process').exec;

function generateTopic(args, file) {
return function() {
return function () {
var cmd = './bin/vows' + ' -i ' + (args || '') +
' ./test/fixtures/isolate/' + file,
options = {cwd: path.resolve(__dirname + '/../')},
callback = this.callback;

exec(cmd, options, function(err, stdout, stderr) {
exec(cmd, options, function (err, stdout, stderr) {
callback(null, {
err: err,
stdout: stdout,
Expand All @@ -29,14 +29,14 @@ function assertExecNotOk(r) {
}

function parseResults(stdout) {
return stdout.split(/\n/g).map(function(s) {
return stdout.split(/\n/g).map(function (s) {
if (!s) return;
return JSON.parse(s);
}).filter(function(s) {return s});
}).filter(function (s) {return s});
}

function assertResultTypePresent(results, type) {
assert.ok(results.some(function(result) {
assert.ok(results.some(function (result) {
return result[0] == type;
}));
}
Expand All @@ -47,7 +47,7 @@ function assertResultsFinish(results, expected) {

finish = finish[1];

Object.keys(expected).forEach(function(key) {
Object.keys(expected).forEach(function (key) {
assert.equal(finish[key], expected[key]);
});
}
Expand All @@ -62,7 +62,7 @@ vows.describe('vows/isolate').addBatch({
'with json reporter': {
topic: generateTopic('--json', 'passing.js'),
'should be ok': assertExecOk,
'should have correct output': function(r) {
'should have correct output': function (r) {
var results = parseResults(r.stdout)

assertResultTypePresent(results, 'subject');
Expand All @@ -79,7 +79,7 @@ vows.describe('vows/isolate').addBatch({
'with json reporter': {
topic: generateTopic('--json', 'failing.js'),
'should be not ok': assertExecNotOk,
'should have correct output though': function(r) {
'should have correct output though': function (r) {
var results = parseResults(r.stdout);

assertResultsFinish(results, {
Expand All @@ -93,11 +93,11 @@ vows.describe('vows/isolate').addBatch({
'with json reporter': {
topic: generateTopic('--json', 'stderr.js'),
'should be ok': assertExecOk,
'should have stderr': function(r) {
'should have stderr': function (r) {
assert.equal(r.stderr,
['oh no!', 'oh no!', 'oh no!', 'oh no!', ''].join('\n'));
},
'should have correct output': function(r) {
'should have correct output': function (r) {
var results= parseResults(r.stdout);

assertResultsFinish(results, {
Expand All @@ -111,7 +111,7 @@ vows.describe('vows/isolate').addBatch({
'with json reporter': {
topic: generateTopic('--json', 'log.js'),
'should be ok': assertExecOk,
'should have correct output': function(r) {
'should have correct output': function (r) {
var results= parseResults(r.stdout);

assertResultsFinish(results, {
Expand All @@ -125,7 +125,7 @@ vows.describe('vows/isolate').addBatch({
'with json reporter': {
topic: generateTopic('--json', '*'),
'should be not ok': assertExecNotOk,
'should have correct output': function(r) {
'should have correct output': function (r) {
var results= parseResults(r.stdout);

assertResultsFinish(results, {
Expand Down

0 comments on commit c8ee815

Please sign in to comment.