Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: fix broken snyk help
  • Loading branch information
Konstantin Yegupov committed Jun 10, 2019
1 parent f21a78f commit 19ff58f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cli/commands/help.ts
Expand Up @@ -3,7 +3,7 @@ import * as path from 'path';
import * as Debug from 'debug';
const debug = Debug('snyk');

export async function help(item: string | boolean) {
export = async function help(item: string | boolean) {
if (!item || item === true || typeof item !== 'string') {
item = 'usage';
}
Expand All @@ -14,9 +14,9 @@ export async function help(item: string | boolean) {

const filename = path.resolve(__dirname, '../../../help', item + '.txt');
try {
await fs.readFile(filename, 'utf8');
return await fs.readFile(filename, 'utf8');
} catch (error) {
debug(error);
return `'${item}' help can't be found at location: ${filename}`;
}
}
};
4 changes: 4 additions & 0 deletions test/acceptance/cli.acceptance.test.ts
Expand Up @@ -2801,6 +2801,10 @@ test('`test --insecure`', async (t) => {
});
});

test("snyk help doesn't crash", async (t) => {
t.match(await cli.help(), /Usage/);
});

/**
* We can't expect all test environments to have Maven installed
* So, hijack the system exec call and return the expected output
Expand Down

0 comments on commit 19ff58f

Please sign in to comment.