Skip to content

Commit

Permalink
Updated a bunch of node dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbluhm committed Mar 21, 2018
1 parent f13068e commit 6b1bc2c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function EnvCmd (args) {

// Handle a few special signals and then the general node exit event
// on both parent and spawned process
process.on('SIGINT', TerminateSpawnedProc.bind(sharedState, proc))
process.on('SIGTERM', TerminateSpawnedProc.bind(sharedState, proc))
process.on('exit', TerminateSpawnedProc.bind(sharedState, proc))
process.once('SIGINT', TerminateSpawnedProc.bind(sharedState, proc))
process.once('SIGTERM', TerminateSpawnedProc.bind(sharedState, proc))
process.once('exit', TerminateSpawnedProc.bind(sharedState, proc))
proc.on('exit', TerminateParentProcess)

return proc
Expand Down Expand Up @@ -306,7 +306,7 @@ function ResolveEnvFilePath (userPath) {
* Helper for terminating the spawned process
* @param {ProccessHandler} proc The spawned process handler
*/
function TerminateSpawnedProc(proc) {
function TerminateSpawnedProc (proc) {
if (!this.exitCalled) {
this.exitCalled = true
proc.kill('SIGTERM')
Expand All @@ -316,7 +316,7 @@ function TerminateSpawnedProc(proc) {
/**
* Helper for terminating the parent process
*/
function TerminateParentProcess() {
function TerminateParentProcess () {
if (!this.exitCalled) {
this.exitCalled = true
process.exit(1)
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"version": "7.0.0",
"description": "Executes a command using the envs in the provided env file",
"main": "lib/index.js",
"engines" : {
"node" : ">=4.0.0"
"engines": {
"node": ">=4.0.0"
},
"bin": {
"env-cmd": "bin/env-cmd.js"
},
"scripts": {
"test": "mocha",
"test-cover": "istanbul cover node_modules/.bin/_mocha -- -R spec",
"test-cover": "nyc --reporter=lcov --reporter=text npm test",
"test-lint": "standard",
"coveralls": "coveralls < coverage/lcov.info",
"lint": "standard --fix"
Expand Down Expand Up @@ -41,15 +41,15 @@
},
"homepage": "https://github.com/toddbluhm/env-cmd#readme",
"dependencies": {
"cross-spawn": "^5.0.1"
"cross-spawn": "^6.0.5"
},
"devDependencies": {
"better-assert": "^1.0.2",
"coveralls": "^2.11.12",
"istanbul": "^0.4.4",
"mocha": "^3.0.2",
"proxyquire": "^1.7.10",
"sinon": "^3.3.0",
"standard": "^10.0.0"
"coveralls": "^3.0.0",
"mocha": "^5.0.4",
"nyc": "^11.6.0",
"proxyquire": "^2.0.1",
"sinon": "^4.4.6",
"standard": "^11.0.1"
}
}
21 changes: 11 additions & 10 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('env-cmd', function () {
proxyquire.callThru()
})
afterEach(function () {
spawnStub.reset()
spawnStub.resetHistory()
})
it('should parse env vars from JSON with node module loader if file extension is .json', function () {
EnvCmd(['./test/.env.json', 'echo', '$BOB'])
Expand Down Expand Up @@ -229,7 +229,7 @@ describe('env-cmd', function () {
proxyquire.callThru()
})
afterEach(function () {
spawnStub.reset()
spawnStub.resetHistory()
})
it('should parse env vars from .env-cmdrc file using development env', function () {
EnvCmd(['development', 'echo', '$BOB'])
Expand Down Expand Up @@ -320,8 +320,9 @@ describe('env-cmd', function () {
this.readFileStub.restore()
})
afterEach(function () {
spawnStub.reset()
this.readFileStub.reset()
spawnStub.resetHistory()
this.readFileStub.resetHistory()
process.removeAllListeners();
})
it('should spawn a new process with the env vars set', function () {
this.readFileStub.returns('BOB=COOL\nNODE_ENV=dev\nANSWER=42\n')
Expand Down Expand Up @@ -398,13 +399,13 @@ describe('env-cmd', function () {
it('should print help text and error if error contains \'passed\'', function () {
HandleUncaughtExceptions(new Error('print help text passed now'))
assert(this.logStub.calledTwice)
this.logStub.restore() // restore here so test success logs get printed
this.logStub.restore() // restore here so test success logs get printed
})

it('should print just there error if error does not contain \'passed\'', function () {
HandleUncaughtExceptions(new Error('do not print help text now'))
assert(this.logStub.calledOnce)
this.logStub.restore() // restore here so test success logs get printed
this.logStub.restore() // restore here so test success logs get printed
})
})

Expand Down Expand Up @@ -447,7 +448,7 @@ describe('env-cmd', function () {
})
})

describe('TerminateSpawnedProc', function() {
describe('TerminateSpawnedProc', function () {
beforeEach(function () {
this.procStub = sinon.stub()
this.proc = {
Expand All @@ -468,7 +469,7 @@ describe('env-cmd', function () {
})

it('should not call kill method if the spawn process is already dying', function () {
this.exitCalled = true;
this.exitCalled = true
TerminateSpawnedProc.call(this, this.proc)
assert(this.procStub.callCount === 0)
})
Expand All @@ -480,7 +481,7 @@ describe('env-cmd', function () {
this.exitCalled = false
})

afterEach(function() {
afterEach(function () {
this.exitStub.restore()
})

Expand All @@ -496,7 +497,7 @@ describe('env-cmd', function () {
})

it('should not call exit method if the process is already dying', function () {
this.exitCalled = true;
this.exitCalled = true
TerminateParentProcess.call(this)
assert(this.exitStub.callCount === 0)
})
Expand Down

0 comments on commit 6b1bc2c

Please sign in to comment.