Skip to content

Commit

Permalink
remove windows specific reposne in stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
stammen committed Nov 16, 2012
1 parent 8ceef77 commit d419819
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/isolate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function generateTopic(args, file) {
' ./test/fixtures/isolate/' + file,
options = {cwd: path.resolve(__dirname + '/../')},
callback = this.callback;

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

function parseResults(stdout) {
return stdout.split(/\n/g).map(function (s) {
var results = stdout.split('\n');

// win32 returns cmd. need to filter out
if(process.platform === 'win32') {
results.shift();
}

return results.map(function (s) {
if (!s) return;
return JSON.parse(s);
}).filter(function (s) {return s});
Expand Down Expand Up @@ -63,7 +71,7 @@ vows.describe('vows/isolate').addBatch({
topic: generateTopic('--json', 'passing.js'),
'should be ok': assertExecOk,
'should have correct output': function (r) {
var results = parseResults(r.stdout)
var results = parseResults(r.stdout)

assertResultTypePresent(results, 'subject');
assertResultTypePresent(results, 'end');
Expand Down Expand Up @@ -98,7 +106,7 @@ vows.describe('vows/isolate').addBatch({
['oh no!', 'oh no!', 'oh no!', 'oh no!', ''].join(os.EOL));
},
'should have correct output': function (r) {
var results= parseResults(r.stdout);
var results= parseResults(r.stdout);

assertResultsFinish(results, {
total: 4,
Expand Down Expand Up @@ -126,7 +134,7 @@ vows.describe('vows/isolate').addBatch({
topic: generateTopic('--json', '*'),
'should be not ok': assertExecNotOk,
'should have correct output': function (r) {
var results= parseResults(r.stdout);
var results= parseResults(r.stdout);

assertResultsFinish(results, {
total: 16,
Expand Down

0 comments on commit d419819

Please sign in to comment.