background-service-runner
Advanced tools
Comparing version 0.90.11 to 0.90.13
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
// console.log( child ); | ||
console.log( child ); | ||
console.log('child job running with pid: ', child.pid ); | ||
@@ -10,0 +10,0 @@ console.log('child log file is in ', __dirname + '/job.log' ); |
module.exports = require('./lib/DaemonRunner'); | ||
module.exports.mocks = { | ||
MockSpawn: require('./test/mocks/MockSpawn'), | ||
MockChild: require('./test/mocks/MockChild') | ||
}; |
{ | ||
"name": "background-service-runner", | ||
"version": "0.90.11", | ||
"version": "0.90.13", | ||
"description": "A daemon runner utility for node, python, shell and other executable services. Can be configured to run a monitored or detached child process or groups of processes.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -38,5 +38,12 @@ # Background Service Runner | ||
## Mocks | ||
The project exposes two mocks for testing. | ||
* MockSpawn | ||
* MockChild | ||
_Note: works in linux/unix but probably not in windows._ | ||
- - - | ||
<p><small><em>Copyright © 2014, rain city software | Version 0.90.11</em></small></p> | ||
<p><small><em>Copyright © 2014, rain city software | Version 0.90.13</em></small></p> |
@@ -10,3 +10,4 @@ /** | ||
log = require('simple-node-logger' ).createSimpleLogger(), | ||
DaemonRunner = require('../lib/DaemonRunner'); | ||
DaemonRunner = require('../lib/DaemonRunner' ), | ||
MockSpawn = require('./mocks/MockSpawn'); | ||
@@ -16,2 +17,4 @@ describe('DaemonRunner', function() { | ||
log.setLevel('fatal'); | ||
var createOptions = function() { | ||
@@ -21,11 +24,2 @@ var opts = {}; | ||
opts.log = log; | ||
opts.spawn = function(cmd, args, opts) { | ||
return { | ||
command:cmd, | ||
args:args, | ||
opts:opts, | ||
unref:function() { }, | ||
pid:dash.random(1000, 31000) | ||
}; | ||
}; | ||
@@ -63,5 +57,27 @@ return opts; | ||
describe('start', function() { | ||
var runner = new DaemonRunner( createOptions() ); | ||
it('should start a mock command'); | ||
var opts = createOptions(), | ||
mock = new MockSpawn(); | ||
opts.spawn = mock.spawn; | ||
it('should start a mock command', function() { | ||
var runner = new DaemonRunner( opts ), | ||
cmd = __dirname + '/fixtures/test-script.sh', | ||
args = [ 'foo', 'bar' ], | ||
child; | ||
child = runner.start( cmd, args ); | ||
should.exist( child ); | ||
mock.getCommand().should.equal( cmd ); | ||
mock.getArgs().should.equal( args ); | ||
should.exist( mock.getSpawnOptions() ); | ||
child.pid.should.be.above( 1000 ); | ||
child.getReferenced().should.equal( false ); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14039
14
344
49