From 9da35b5277122449163e8a50025e398e71a9283f Mon Sep 17 00:00:00 2001 From: p0rth01998 Date: Fri, 15 May 2020 08:48:45 +0530 Subject: [PATCH 1/3] fix: typo update in test & ts lint update in ts --- src/signal-termination.ts | 2 +- test/env-cmd.spec.ts | 8 ++++---- test/get-env-vars.spec.ts | 38 +++++++++++++++++++------------------- 3 files changed, 24 insertions(+), 24 deletions(-) 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')) }) From 72be538fc1f997d8cdf5af88239eded7c7d7520f Mon Sep 17 00:00:00 2001 From: p0rth01998 Date: Fri, 15 May 2020 09:03:16 +0530 Subject: [PATCH 2/3] fix: version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 104b957..c4a7198 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@types/chai": "^4.0.0", "@types/cross-spawn": "^6.0.0", "@types/mocha": "^7.0.0", - "@types/node": "^12.0.0", + "@types/node": "^14.0.1", "@types/sinon": "^9.0.0", "chai": "^4.0.0", "coveralls": "^3.0.0", From 70084037f3f2b66a24ea1243501c3f6e482a031c Mon Sep 17 00:00:00 2001 From: p0rth01998 Date: Fri, 15 May 2020 10:22:51 +0530 Subject: [PATCH 3/3] revert: version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c4a7198..104b957 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@types/chai": "^4.0.0", "@types/cross-spawn": "^6.0.0", "@types/mocha": "^7.0.0", - "@types/node": "^14.0.1", + "@types/node": "^12.0.0", "@types/sinon": "^9.0.0", "chai": "^4.0.0", "coveralls": "^3.0.0",