Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from carnun/master
Change kill signal and add unit test
- Loading branch information
Showing
5 changed files
with
27 additions
and
5 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,23 @@ | ||
const { expect } = require('chai'); | ||
const runner = require('../lib/runner'); | ||
|
||
describe.only('Runner', () => { | ||
it('Should start a long running process and kill it before it finishes', (done) => { | ||
const kill = runner('sleep 10') | ||
setTimeout(function() { | ||
kill().then(function(result) { | ||
expect(result).to.deep.equal([0,null]) | ||
done() | ||
}) | ||
}, 1) | ||
}) | ||
it('Should start a short running process and not kill it before it finishes', (done) => { | ||
const kill = runner('echo') | ||
setTimeout(function() { | ||
kill().then(function(result) { | ||
expect(result).to.deep.equal([1,0]) | ||
done() | ||
}) | ||
}, 5) | ||
}) | ||
}) |