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
|
# 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)
|
- **Fix**: CLI will now exit with non-zero error code when an error is encountered (thanks to blagh)
|
||||||
|
|
||||||
## 9.0.1
|
## 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
|
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.
|
anywhere states using `--` as intended or official behavior.
|
||||||
- **Change**: Fixed some documentation issues
|
- **Change**: Fixed some documentation issues
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "env-cmd",
|
"name": "env-cmd",
|
||||||
"version": "9.0.1",
|
"version": "9.0.2",
|
||||||
"description": "Executes a command using the environment variables in an env file",
|
"description": "Executes a command using the environment variables in an env file",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@ -8,20 +8,39 @@ import * as envCmdLib from '../src/env-cmd'
|
|||||||
describe('CLI', (): void => {
|
describe('CLI', (): void => {
|
||||||
let parseArgsStub: sinon.SinonStub
|
let parseArgsStub: sinon.SinonStub
|
||||||
let envCmdStub: sinon.SinonStub
|
let envCmdStub: sinon.SinonStub
|
||||||
|
let processExitStub: sinon.SinonStub
|
||||||
|
|
||||||
before((): void => {
|
before((): void => {
|
||||||
parseArgsStub = sinon.stub(parseArgsLib, 'parseArgs')
|
parseArgsStub = sinon.stub(parseArgsLib, 'parseArgs')
|
||||||
envCmdStub = sinon.stub(envCmdLib, 'EnvCmd')
|
envCmdStub = sinon.stub(envCmdLib, 'EnvCmd')
|
||||||
|
processExitStub = sinon.stub(process, 'exit')
|
||||||
})
|
})
|
||||||
|
|
||||||
after((): void => {
|
after((): void => {
|
||||||
sinon.restore()
|
sinon.restore()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach((): void => {
|
||||||
|
sinon.resetHistory()
|
||||||
|
sinon.resetBehavior()
|
||||||
|
})
|
||||||
|
|
||||||
it('should parse the provided args and execute the EnvCmd', async (): Promise<void> => {
|
it('should parse the provided args and execute the EnvCmd', async (): Promise<void> => {
|
||||||
parseArgsStub.returns({})
|
parseArgsStub.returns({})
|
||||||
await envCmdLib.CLI(['node', './env-cmd', '-v'])
|
await envCmdLib.CLI(['node', './env-cmd', '-v'])
|
||||||
assert.equal(parseArgsStub.callCount, 1)
|
assert.equal(parseArgsStub.callCount, 1)
|
||||||
assert.equal(envCmdStub.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