Add ability to output the CLI in JSON format #124

Merged
Vylpes merged 4 commits from feature/73-cli-json into develop 2024-01-19 18:02:16 +00:00
Showing only changes of commit b2722b487e - Show all commits

View file

@ -88,7 +88,25 @@ describe('subreddit', () => {
expect(subreddit).toBe('Horses');
}, 5000);
})
});
describe('json', () => {
test('GIVEN -j is supplied, EXPECT output to be valid JSON', async () => {
const result = await cli(['-j'], '.');
const json = JSON.parse(result.stdout);
expect(json).toBeDefined();
}, 5000);
test('GIVEN --json is supplied, EXPECT output to be valid JSON', async () => {
const result = await cli(['--json'], '.');
const json = JSON.parse(result.stdout);
expect(json).toBeDefined();
}, 5000);
});
function cli(args: string[], cwd: string): Promise<cliResult> {
return new Promise(resolve => {