diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/flagged-respawn/test | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/flagged-respawn/test')
-rw-r--r-- | node_modules/flagged-respawn/test/bin/exit_code.js | 13 | ||||
-rw-r--r-- | node_modules/flagged-respawn/test/bin/respawner.js | 17 | ||||
-rw-r--r-- | node_modules/flagged-respawn/test/bin/signal.js | 16 | ||||
-rw-r--r-- | node_modules/flagged-respawn/test/index.js | 99 |
4 files changed, 0 insertions, 145 deletions
diff --git a/node_modules/flagged-respawn/test/bin/exit_code.js b/node_modules/flagged-respawn/test/bin/exit_code.js deleted file mode 100644 index f2fff2d52..000000000 --- a/node_modules/flagged-respawn/test/bin/exit_code.js +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -const flaggedRespawn = require('../../'); - -flaggedRespawn(['--harmony'], process.argv, function (ready) { - - if (ready) { - setTimeout(function () { - process.exit(100); - }, 100); - } - -}); diff --git a/node_modules/flagged-respawn/test/bin/respawner.js b/node_modules/flagged-respawn/test/bin/respawner.js deleted file mode 100644 index 71348ba67..000000000 --- a/node_modules/flagged-respawn/test/bin/respawner.js +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env node - -const flaggedRespawn = require('../../'); - -// get a list of all possible v8 flags for the running version of node -const v8flags = require('v8flags').fetch(); - -flaggedRespawn(v8flags, process.argv, function (ready, child) { - if (ready) { - console.log('Running!'); - } else { - console.log('Special flags found, respawning.'); - } - if (child.pid !== process.pid) { - console.log('Respawned to PID:', child.pid); - } -}); diff --git a/node_modules/flagged-respawn/test/bin/signal.js b/node_modules/flagged-respawn/test/bin/signal.js deleted file mode 100644 index f4a1edf1a..000000000 --- a/node_modules/flagged-respawn/test/bin/signal.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node - -const flaggedRespawn = require('../../'); - -flaggedRespawn(['--harmony'], process.argv, function (ready, child) { - - if (ready) { - setTimeout(function() { - process.exit(); - }, 100); - } else { - console.log('got child!'); - child.kill('SIGHUP'); - } - -}); diff --git a/node_modules/flagged-respawn/test/index.js b/node_modules/flagged-respawn/test/index.js deleted file mode 100644 index d83fce3aa..000000000 --- a/node_modules/flagged-respawn/test/index.js +++ /dev/null @@ -1,99 +0,0 @@ -const expect = require('chai').expect; -const exec = require('child_process').exec; - -const reorder = require('../lib/reorder'); -const flaggedRespawn = require('../'); - -describe('flaggedRespawn', function () { - var flags = ['--harmony', '--use_strict', '--stack_size'] - - describe('reorder', function () { - - it('should re-order args, placing special flags first', function () { - var needsRespawn = ['node', 'file.js', '--flag', '--harmony', 'command']; - var noRespawnNeeded = ['node', 'bin/flagged-respawn', 'thing']; - expect(reorder(flags, needsRespawn)) - .to.deep.equal(['node', '--harmony', 'file.js', '--flag', 'command']); - expect(reorder(flags, noRespawnNeeded)) - .to.deep.equal(noRespawnNeeded); - }); - - it('should keep flags values when not placed first', function () { - var args = ['node', 'file.js', '--stack_size=2048']; - var expected = ['node', '--stack_size=2048', 'file.js']; - expect(reorder(flags, args)).to.deep.equal(expected); - }); - - it('should ignore special flags when they are in the correct position', function () { - var args = ['node', '--harmony', 'file.js', '--flag']; - expect(reorder(flags, reorder(flags, args))).to.deep.equal(args); - }); - - }); - - describe('execute', function () { - - it('should throw if no flags are specified', function () { - expect(function () { flaggedRespawn.execute(); }).to.throw; - }); - - it('should throw if no argv is specified', function () { - expect(function () { flaggedRespawn.execute(flags); }).to.throw; - }); - - it('should respawn and pipe stderr/stdout to parent', function (done) { - exec('node ./test/bin/respawner.js --harmony', function (err, stdout, stderr) { - expect(stdout.replace(/[0-9]/g, '')).to.equal('Special flags found, respawning.\nRespawned to PID: \nRunning!\n'); - done(); - }); - }); - - it('should respawn and pass exit code from child to parent', function (done) { - exec('node ./test/bin/exit_code.js --harmony', function (err, stdout, stderr) { - expect(err.code).to.equal(100); - done(); - }); - }); - - it.skip('should respawn; if child is killed, parent should exit with same signal', function (done) { - // TODO: figure out why travis hates this - exec('node ./test/bin/signal.js --harmony', function (err, stdout, stderr) { - console.log('err', err); - console.log('stdout', stdout); - console.log('stderr', stderr); - expect(err.signal).to.equal('SIGHUP'); - done(); - }); - }); - - it('should call back with ready as true when respawn is not needed', function () { - var argv = ['node', './test/bin/respawner']; - flaggedRespawn(flags, argv, function (ready) { - expect(ready).to.be.true; - }); - }); - - it('should call back with ready as false when respawn is needed', function () { - var argv = ['node', './test/bin/respawner', '--harmony']; - flaggedRespawn(flags, argv, function (ready) { - expect(ready).to.be.false; - }); - }); - - it('should call back with the child process when ready', function () { - var argv = ['node', './test/bin/respawner', '--harmony']; - flaggedRespawn(flags, argv, function (ready, child) { - expect(child.pid).to.not.equal(process.pid); - }); - }); - - it('should call back with own process when respawn not needed', function () { - var argv = ['node', './test/bin/respawner']; - flaggedRespawn(flags, argv, function (ready, child) { - expect(child.pid).to.equal(process.pid); - }); - }); - - }); - -}); |