MCPcopy
hub / github.com/tj/commander.js / makeProgram

Function makeProgram

tests/options.conflicts.test.js:8–26  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

6
7describe('Option.conflicts()', () => {
8 function makeProgram(t) {
9 const actionMock = t.mock.fn();
10 const program = createTestCommand();
11 program
12 .command('foo')
13 .addOption(
14 new commander.Option('-s, --silent', "Don't print anything").env(
15 'SILENT',
16 ),
17 )
18 .addOption(
19 new commander.Option('-j, --json', 'Format output as json')
20 .env('JSON')
21 .conflicts(['silent']),
22 )
23 .action(actionMock);
24
25 return { program, actionMock };
26 }
27
28 test.beforeEach(() => {
29 delete process.env.SILENT;

Callers 1

Calls 6

createTestCommandFunction · 0.90
actionMethod · 0.80
addOptionMethod · 0.80
commandMethod · 0.80
envMethod · 0.80
conflictsMethod · 0.80

Tested by

no test coverage detected