Browse files

[test dist] Use `assert-called`

  • Loading branch information...
1 parent 0f3f7f2 commit 13d969a721e5bca0c8071999a7b97c9693c4a776 @mmalecki committed Aug 4, 2012
Showing with 6 additions and 7 deletions.
  1. +3 −0 package.json
  2. +3 −7 test/spawn-command-test.js
View
3 package.json
@@ -6,5 +6,8 @@
"main": "./lib/spawn-command",
"scripts": {
"test": "node test/spawn-command-test.js"
+ },
+ "devDependencies": {
+ "assert-called": "0.0.x"
}
}
View
10 test/spawn-command-test.js
@@ -1,5 +1,6 @@
var path = require('path'),
assert = require('assert'),
+ assertCalled = require('assert-called'),
spawnCommand = require('../');
var child = spawnCommand('grep commit < ' + path.join(__dirname, 'fixtures', 'commit')),
@@ -15,13 +16,8 @@ child.stderr.on('data', function (chunk) {
stderr += chunk;
});
-child.on('exit', function (exitCode) {
- exited = true;
+child.on('exit', assertCalled(function (exitCode) {
assert.equal(exitCode, 0);
assert.equal(stdout, 'commit 26b11915b1c16440468a4b5f4b07d2409b98c68c\n');
assert.equal(stderr, '');
-});
-
-process.on('exit', function () {
- assert(exited);
-});
+}));

0 comments on commit 13d969a

Please sign in to comment.