Permalink
Browse files

[style] respect cloudhead's style

  • Loading branch information...
1 parent dcf5021 commit c8ee8156327b7a5a36da48f338f7553e68c5d0ec @indutny indutny committed Aug 5, 2011
View
@@ -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}
@@ -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') {
@@ -9,7 +9,7 @@ var options = {},
var messages = [], lastContext;
this.name = 'dot-matrix';
-this.setStream = function(s) {
+this.setStream = function (s) {
options.stream = s;
};
@@ -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) {
@@ -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) {
@@ -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 () {
@@ -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
@@ -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);
}
@@ -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);
}
},
@@ -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);
}
View
@@ -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,
@@ -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;
}));
}
@@ -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]);
});
}
@@ -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');
@@ -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, {
@@ -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, {
@@ -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, {
@@ -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, {

0 comments on commit c8ee815

Please sign in to comment.