-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcli-args.unit.test.ts
More file actions
34 lines (27 loc) · 1001 Bytes
/
cli-args.unit.test.ts
File metadata and controls
34 lines (27 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { yargsCli } from './cli-args.js';
import type { PluginSetupBinding } from './types.js';
const bareBindings: PluginSetupBinding[] = [
{
slug: 'eslint',
title: 'ESLint',
packageName: '@code-pushup/eslint-plugin',
generateConfig: () => ({ imports: [], pluginInit: [] }),
},
];
describe('yargsCli', () => {
it('should expose --eslint.patterns as a flat key', async () => {
const argv = await yargsCli(bareBindings).parse([
'--eslint.patterns',
'src',
]);
expect(argv['eslint.patterns']).toBe('src');
});
it('should expose --no-eslint.categories as a flat false', async () => {
const argv = await yargsCli(bareBindings).parse(['--no-eslint.categories']);
expect(argv['eslint.categories']).toBeFalse();
});
it('should expose --eslint.categories without a value as a flat true', async () => {
const argv = await yargsCli(bareBindings).parse(['--eslint.categories']);
expect(argv['eslint.categories']).toBeTrue();
});
});