mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
Publish v9.0.2
- Updated test cases to bring coverage back to 100% - Updated package.json version number - Update changelog
This commit is contained in:
parent
012230dd8a
commit
09ffda4abf
@ -1,12 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 9.0.2 - Unreleased
|
||||
## 9.0.2
|
||||
|
||||
- **Fix**: CLI will now exit with non-zero error code when an error is encountered (thanks to blagh)
|
||||
|
||||
## 9.0.1
|
||||
|
||||
- **BREAKING**: Fixed major bug that required passing `--` inorder to pass flags to the command.
|
||||
- **BREAKING**: Fixed major bug that required passing `--` in order to pass flags to the command.
|
||||
Normally I release major breaking changes as major versions, but this was a bug and no documentation
|
||||
anywhere states using `--` as intended or official behavior.
|
||||
- **Change**: Fixed some documentation issues
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "env-cmd",
|
||||
"version": "9.0.1",
|
||||
"version": "9.0.2",
|
||||
"description": "Executes a command using the environment variables in an env file",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@ -8,20 +8,39 @@ import * as envCmdLib from '../src/env-cmd'
|
||||
describe('CLI', (): void => {
|
||||
let parseArgsStub: sinon.SinonStub
|
||||
let envCmdStub: sinon.SinonStub
|
||||
let processExitStub: sinon.SinonStub
|
||||
|
||||
before((): void => {
|
||||
parseArgsStub = sinon.stub(parseArgsLib, 'parseArgs')
|
||||
envCmdStub = sinon.stub(envCmdLib, 'EnvCmd')
|
||||
processExitStub = sinon.stub(process, 'exit')
|
||||
})
|
||||
|
||||
after((): void => {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
afterEach((): void => {
|
||||
sinon.resetHistory()
|
||||
sinon.resetBehavior()
|
||||
})
|
||||
|
||||
it('should parse the provided args and execute the EnvCmd', async (): Promise<void> => {
|
||||
parseArgsStub.returns({})
|
||||
await envCmdLib.CLI(['node', './env-cmd', '-v'])
|
||||
assert.equal(parseArgsStub.callCount, 1)
|
||||
assert.equal(envCmdStub.callCount, 1)
|
||||
assert.equal(processExitStub.callCount, 0)
|
||||
})
|
||||
|
||||
it('should catch exception if EnvCmd throws an exception', async (): Promise<void> => {
|
||||
parseArgsStub.returns({})
|
||||
envCmdStub.throwsException('Error')
|
||||
await envCmdLib.CLI(['node', './env-cmd', '-v'])
|
||||
assert.equal(parseArgsStub.callCount, 1)
|
||||
assert.equal(envCmdStub.callCount, 1)
|
||||
assert.equal(processExitStub.callCount, 1)
|
||||
assert.equal(processExitStub.args[0][0], 1)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user