Socket
Socket
Sign inDemoInstall

background-service-runner

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

background-service-runner - npm Package Compare versions

Comparing version 0.90.11 to 0.90.13

test/fixtures/test-script.sh

2

examples/test-runner.js

@@ -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 );
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc