diff --git a/src/signal-termination.ts b/src/signal-termination.ts index 5f47469..db8b6fc 100644 --- a/src/signal-termination.ts +++ b/src/signal-termination.ts @@ -6,7 +6,7 @@ const SIGNALS_TO_HANDLE: NodeJS.Signals[] = [ export class TermSignals { private readonly terminateSpawnedProcessFuncHandlers: { [key: string]: any } = {} - private readonly verbose: boolean = false; + private readonly verbose: boolean = false public _exitCalled = false constructor (options: { verbose?: boolean } = {}) { diff --git a/test/env-cmd.spec.ts b/test/env-cmd.spec.ts index 1e7b284..2db408e 100644 --- a/test/env-cmd.spec.ts +++ b/test/env-cmd.spec.ts @@ -91,7 +91,7 @@ describe('EnvCmd', (): void => { assert.equal(spawnStub.callCount, 1) }) - it('should should override existing env vars if noOverride option is false/missing', + it('should override existing env vars if noOverride option is false/missing', async (): Promise => { process.env.BOB = 'cool' getEnvVarsStub.returns({ BOB: 'test' }) @@ -113,7 +113,7 @@ describe('EnvCmd', (): void => { } ) - it('should should not override existing env vars if noOverride option is true', + it('should not override existing env vars if noOverride option is true', async (): Promise => { process.env.BOB = 'cool' getEnvVarsStub.returns({ BOB: 'test' }) @@ -138,7 +138,7 @@ describe('EnvCmd', (): void => { } ) - it('should should spawn process with shell option if useShell option is true', + it('should spawn process with shell option if useShell option is true', async (): Promise => { process.env.BOB = 'cool' getEnvVarsStub.returns({ BOB: 'test' }) @@ -163,7 +163,7 @@ describe('EnvCmd', (): void => { } ) - it('should should spawn process with command and args expanded if expandEnvs option is true', + it('should spawn process with command and args expanded if expandEnvs option is true', async (): Promise => { getEnvVarsStub.returns({ PING: 'PONG', CMD: 'node' }) await envCmdLib.EnvCmd({ diff --git a/test/get-env-vars.spec.ts b/test/get-env-vars.spec.ts index 942b9d9..59649b8 100644 --- a/test/get-env-vars.spec.ts +++ b/test/get-env-vars.spec.ts @@ -28,11 +28,11 @@ describe('getEnvVars', (): void => { it('should parse the json .rc file from the default path with the given environment', async (): Promise => { - getRCFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getRCFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars({ rc: { environments: ['production'] } }) assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getRCFileVarsStub.callCount, 1) assert.lengthOf(getRCFileVarsStub.args[0][0].environments, 1) assert.equal(getRCFileVarsStub.args[0][0].environments[0], 'production') @@ -43,7 +43,7 @@ describe('getEnvVars', (): void => { it('should print path of custom .rc file and environments to info for verbose', async (): Promise => { logInfoStub = sinon.stub(console, 'info') - getRCFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getRCFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) await getEnvVars({ rc: { environments: ['production'] }, verbose: true }) assert.equal(logInfoStub.callCount, 1) } @@ -53,11 +53,11 @@ describe('getEnvVars', (): void => { const pathError = new Error() pathError.name = 'PathError' getRCFileVarsStub.rejects(pathError) - getRCFileVarsStub.onThirdCall().returns({ THANKS: 'FORALLTHEFISH' }) + getRCFileVarsStub.onThirdCall().returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars({ rc: { environments: ['production'] } }) assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getRCFileVarsStub.callCount, 3) assert.lengthOf(getRCFileVarsStub.args[2][0].environments, 1) assert.equal(getRCFileVarsStub.args[2][0].environments[0], 'production') @@ -118,13 +118,13 @@ describe('getEnvVars', (): void => { }) it('should find .rc file at custom path path', async (): Promise => { - getRCFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getRCFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars({ rc: { environments: ['production'], filePath: '../.custom-rc' } }) assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getRCFileVarsStub.callCount, 1) assert.lengthOf(getRCFileVarsStub.args[0][0].environments, 1) assert.equal(getRCFileVarsStub.args[0][0].environments[0], 'production') @@ -133,7 +133,7 @@ describe('getEnvVars', (): void => { it('should print custom .rc file path to info for verbose', async (): Promise => { logInfoStub = sinon.stub(console, 'info') - getRCFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getRCFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) await getEnvVars({ rc: { environments: ['production'], filePath: '../.custom-rc' }, verbose: true @@ -206,18 +206,18 @@ describe('getEnvVars', (): void => { ) it('should parse the env file from a custom path', async (): Promise => { - getEnvFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars({ envFile: { filePath: '../.env-file' } }) assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getEnvFileVarsStub.callCount, 1) assert.equal(getEnvFileVarsStub.args[0][0], '../.env-file') }) it('should print path of .env file to info for verbose', async (): Promise => { logInfoStub = sinon.stub(console, 'info') - getEnvFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) await getEnvVars({ envFile: { filePath: '../.env-file' }, verbose: true }) assert.equal(logInfoStub.callCount, 1) }) @@ -249,11 +249,11 @@ describe('getEnvVars', (): void => { 'path not found and fallback option provided', async (): Promise => { getEnvFileVarsStub.onFirstCall().rejects('File not found.') - getEnvFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars({ envFile: { filePath: '../.env-file', fallback: true } }) assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getEnvFileVarsStub.callCount, 2) assert.equal(getEnvFileVarsStub.args[1][0], './.env') } @@ -265,36 +265,36 @@ describe('getEnvVars', (): void => { async (): Promise => { logInfoStub = sinon.stub(console, 'info') getEnvFileVarsStub.onFirstCall().rejects('File not found.') - getEnvFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) await getEnvVars({ envFile: { filePath: '../.env-file', fallback: true }, verbose: true }) assert.equal(logInfoStub.callCount, 2) } ) it('should parse the env file from the default path', async (): Promise => { - getEnvFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars() assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getEnvFileVarsStub.callCount, 1) assert.equal(getEnvFileVarsStub.args[0][0], './.env') }) it('should print path of .env file to info for verbose', async (): Promise => { logInfoStub = sinon.stub(console, 'info') - getEnvFileVarsStub.returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.returns({ THANKS: 'FOR ALL THE FISH' }) await getEnvVars({ verbose: true }) assert.equal(logInfoStub.callCount, 1) }) it('should search all default env file paths', async (): Promise => { getEnvFileVarsStub.throws('Not found.') - getEnvFileVarsStub.onThirdCall().returns({ THANKS: 'FORALLTHEFISH' }) + getEnvFileVarsStub.onThirdCall().returns({ THANKS: 'FOR ALL THE FISH' }) const envs = await getEnvVars() assert.isOk(envs) assert.lengthOf(Object.keys(envs), 1) - assert.equal(envs.THANKS, 'FORALLTHEFISH') + assert.equal(envs.THANKS, 'FOR ALL THE FISH') assert.equal(getEnvFileVarsStub.callCount, 3) assert.isTrue(getEnvFileVarsStub.calledWithExactly('./.env.json')) })