Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b95892
commit aef46d0
Showing
3 changed files
with
32 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,33 @@ | ||
if (module == require.main) { | ||
|
||
var spawn = require('child_process').spawn, | ||
path = require('path'); | ||
|
||
var tests = ['test-fail.js', 'test-multinstance.js', | ||
'test-namedtest.js', 'test-simple.js']; | ||
var spawn = require('child_process').spawn; | ||
var path = require('path'); | ||
var assert = require('assert'); | ||
|
||
testPassCount = 0; | ||
|
||
for (var i=0; i < tests.length; i++) { | ||
var test = tests[i]; | ||
var tests = { | ||
'test-fail.js': 1, | ||
'test-multinstance.js': 0, | ||
'test-namedtest.js': 0, | ||
'test-simple.js': 0, | ||
'test-stacktrace': 8 | ||
}; | ||
|
||
for (var test in tests) { | ||
var expectedRetCode = tests[test]; | ||
var testProcess = spawn(process.execPath, [path.join(__dirname, test)]); | ||
testProcess.stdout.on('data', function(data) { | ||
|
||
testProcess.stdout.on('data', function (data) { | ||
process.stdout.write(data.toString()); | ||
}); | ||
testProcess.stderr.on('data', function(data) { | ||
|
||
testProcess.stderr.on('data', function (data) { | ||
process.stderr.write(data.toString()); | ||
}); | ||
|
||
testProcess.on('exit', function(code, signal) { | ||
if (code === 0) { testPassCount++ }; | ||
}); | ||
(function (expectedRetCode) { | ||
testProcess.on('exit', function (code, signal) { | ||
assert.equal(expectedRetCode, code); | ||
}); | ||
})(expectedRetCode); | ||
} | ||
|
||
process.once('exit', function(code, signal) { | ||
if (testPassCount === 3) { | ||
process.exit(0); | ||
} else { | ||
process.exit(1); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var test = require('./testy')(); | ||
var assert = test.assert; | ||
assert.equal(2, 3); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters