Merge pull request #136 from p0rth01998/Minor_Typo

Fix: typo update in test & ts lint update
This commit is contained in:
Todd Bluhm 2020-05-15 12:14:07 -05:00 committed by GitHub
commit 8f35b71651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 24 deletions

View File

@ -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 } = {}) {

View File

@ -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<void> => {
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<void> => {
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<void> => {
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<void> => {
getEnvVarsStub.returns({ PING: 'PONG', CMD: 'node' })
await envCmdLib.EnvCmd({

View File

@ -28,11 +28,11 @@ describe('getEnvVars', (): void => {
it('should parse the json .rc file from the default path with the given environment',
async (): Promise<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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<void> => {
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'))
})