Skip to content

Commit

Permalink
fix(test): leaking config load
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Apr 1, 2020
1 parent 0b38b94 commit 2fc7d76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/config/args.ts
Expand Up @@ -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 {
Expand Down
15 changes: 11 additions & 4 deletions test/config/TestConfig.ts
Expand Up @@ -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)
Expand Down

0 comments on commit 2fc7d76

Please sign in to comment.