1
0
Fork 0

fix(test): leaking config load

This commit is contained in:
ssube 2020-04-01 16:58:26 -05:00
parent 0b38b94475
commit 2fc7d7683c
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 11 additions and 5 deletions

View File

@ -164,7 +164,6 @@ export async function parseArgs(argv: Array<string>): Promise<ParseResults> {
.alias('version', 'v');
// @TODO: this should not need a cast but the parser's type omits command options and doesn't expose camelCase
// tslint:disable-next-line:no-any
const args = parser.parse(argv) as any;
return {

View File

@ -6,10 +6,17 @@ import { loadConfig, readConfig } from '../../src/config';
import { describeLeaks, itLeaks } from '../helpers/async';
describeLeaks('load config helper', async () => {
itLeaks('should load an existing config', async () => {
const config = await loadConfig('config-stderr.yml', join(__dirname, '..', 'docs'));
expect(config.data.logger.name).to.equal('salty-dog');
});
itLeaks('should load an existing config', async () =>
expect(loadConfig('config-stderr.yml', join(__dirname, '..', 'docs'))).to.eventually.deep.include({
data: {
logger: {
level: 'debug',
name: 'salty-dog',
stream: process.stderr,
},
},
})
);
itLeaks('should throw when config is missing', async () =>
expect(loadConfig('missing.yml', join(__dirname, '..', 'docs'))).to.eventually.be.rejectedWith(NotFoundError)