Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Jul 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/command.exitOverride.test.js
Expand Up @@ -175,19 +175,19 @@ describe('.exitOverride and error details', () => {
expectCommanderError(caughtErr, 0, 'commander.version', myVersion);
});

// Have not worked out a cleaner way to do this, so suppress warning.
// eslint-disable-next-line jest/no-test-callback
test('when executableSubcommand succeeds then call exitOverride', (done) => {
test('when executableSubcommand succeeds then call exitOverride', async() => {
expect.hasAssertions();
const pm = path.join(__dirname, 'fixtures/pm');
michga marked this conversation as resolved.
Show resolved Hide resolved
const program = new commander.Command();
program
.exitOverride((err) => {
expectCommanderError(err, 0, 'commander.executeSubCommandAsync', '(close)');
done();
})
.command('silent', 'description');

program.parse(['node', pm, 'silent']);
await new Promise((resolve) => {
program
.exitOverride((err) => {
expectCommanderError(err, 0, 'commander.executeSubCommandAsync', '(close)');
resolve();
})
.command('silent', 'description');
program.parse(['node', pm, 'silent']);
});
});

test('when mandatory program option missing then throw CommanderError', () => {
Expand Down