Skip to content
Myr

tests: remove eslint-disable jest/no-test-callback (#1312)

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

* tests: remove eslint-disable jest/no-test-callback Instead of using the `done` callback from the test function, we can be using a Promise instead. I've checked that if `resolve` is not called the test fails (timeout). * fix: code style * test: ensure an assertion is made (code review)

authored by michga · committed by GitHub · parent 8fb669f · Browse files · 1 file+11 added−11 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+11 added−11 removed

  • tests:+11 added−11 removed

1 file+11 added−11 removed

modified:tests/command.exitOverride.test.js+11 added-11 removed
173 unmodified lines
174 expect(writeSpy).toHaveBeenCalled();175 expectCommanderError(caughtErr, 0, 'commander.version', myVersion);176 });177178 // Have not worked out a cleaner way to do this, so suppress warning.179 // eslint-disable-next-line jest/no-test-callback180 test('when executableSubcommand succeeds then call exitOverride', (done) => {178 test('when executableSubcommand succeeds then call exitOverride', async() => {179 expect.hasAssertions();180 const pm = path.join(__dirname, 'fixtures/pm');181 const program = new commander.Command();182 await new Promise((resolve) => {183 program184 .exitOverride((err) => {185 expectCommanderError(err, 0, 'commander.executeSubCommandAsync', '(close)');186 done();187 })188 .command('silent', 'description');189190 program.parse(['node', pm, 'silent']);183 program184 .exitOverride((err) => {185 expectCommanderError(err, 0, 'commander.executeSubCommandAsync', '(close)');186 resolve();187 })188 .command('silent', 'description');189 program.parse(['node', pm, 'silent']);190 });191 });192193 test('when mandatory program option missing then throw CommanderError', () => {194 const optionFlags = '-p, --pepper <type>';
15 unmodified lines