Skip to content
Myr

Change initial variable values in test for better error messages

Before adoption: this commit came in with the history the project adopted, so no landing records it.

(cherry picked from commit 87db4ba81c33b0db8a0146afdcaac7e1a4dbcce8)

authored by Wee Bit · committed by Abe Tomoaki · parent 14fb529 · Browse files · 1 file+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−5 removed

  • tests:+5 added−5 removed

1 file+5 added−5 removed

modified:tests/command.addHelpText.test.js+5 added-5 removed
179 unmodified lines
180 expect(stderrSpy).toHaveBeenCalledWith('text\n');181 });182183 test('when help requested then context.error is false', () => {184 let context = {};184 let context;185 const program = new commander.Command();186 program187 .exitOverride()188 .addHelpText('before', (contextParam) => { context = contextParam; });
3 unmodified lines
192 expect(context.error).toBe(false);193 });194195 test('when help for error then context.error is true', () => {196 let context = {};196 let context;197 const program = new commander.Command();198 program199 .exitOverride()200 .addHelpText('before', (contextParam) => { context = contextParam; })
4 unmodified lines
205 expect(context.error).toBe(true);206 });207208 test('when help on program then context.command is program', () => {209 let context = {};209 let context;210 const program = new commander.Command();211 program212 .exitOverride()213 .addHelpText('before', (contextParam) => { context = contextParam; });
3 unmodified lines
217 expect(context.command).toBe(program);218 });219220 test('when help on subcommand and "before" subcommand then context.command is subcommand', () => {221 let context = {};221 let context;222 const program = new commander.Command();223 program224 .exitOverride();225 const sub = program.command('sub')
4 unmodified lines
230 expect(context.command).toBe(sub);231 });232233 test('when help on subcommand and "beforeAll" on program then context.command is subcommand', () => {234 let context = {};234 let context;235 const program = new commander.Command();236 program237 .exitOverride()238 .addHelpText('beforeAll', (contextParam) => { context = contextParam; });
7 unmodified lines