Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[test dist] Use `assert-called`

  • Loading branch information...
commit 13d969a721e5bca0c8071999a7b97c9693c4a776 1 parent 0f3f7f2
Maciej Małecki authored
Showing with 6 additions and 7 deletions.
  1. +3 −0  package.json
  2. +3 −7 test/spawn-command-test.js
3  package.json
View
@@ -6,5 +6,8 @@
"main": "./lib/spawn-command",
"scripts": {
"test": "node test/spawn-command-test.js"
+ },
+ "devDependencies": {
+ "assert-called": "0.0.x"
}
}
10 test/spawn-command-test.js
View
@@ -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);
-});
+}));
Please sign in to comment.
Something went wrong with that request. Please try again.