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

Print Git command if it failed #681

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/commands/commit/withClient/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ const withClient = async (answers: Answers) => {
} catch (error) {
console.error(
chalk.red(
'\nOops! An error ocurred. There is likely additional logging output above.\n'
)
'\n',
'Oops! An error ocurred. There is likely additional logging output above.\n',
'You can run the same commit with this command:\n'
),
'\t',
error.escapedCommand
)
}
}
Expand Down
11 changes: 10 additions & 1 deletion test/commands/commit.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import inquirer from 'inquirer'
import execa from 'execa'
import fs from 'fs'
import chalk from 'chalk'
const mockProcess = require('jest-mock-process')

import configurationVault from '../../src/utils/configurationVault'
Expand Down Expand Up @@ -143,7 +144,15 @@ describe('commit command', () => {
})

it('should print the error to the console', () => {
expect(consoleError).toHaveBeenCalledWith(expect.any(String))
expect(consoleError).toHaveBeenCalledWith(
chalk.red(
'\n',
'Oops! An error ocurred. There is likely additional logging output above.\n',
'You can run the same commit with this command:\n'
),
'\t',
undefined
)
})
})
})
Expand Down