Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Give more context for error output
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdonoh committed Oct 23, 2019
1 parent a48b94f commit d4771b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions scripts/changeScanner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Object.keys(changes).forEach(packageName => {

/* eslint-disable no-console */
if (errors.length > 0) {
console.error(`Please update the version number and CHANGELOG for every package that is being
changed in this branch. The following problems were found:
`);
errors.forEach(error => console.error(chalk.red(error)));
console.error(''); // empty line for spacing
process.exit(1);
Expand Down
8 changes: 6 additions & 2 deletions scripts/changeScanner/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ describe(`changeScanner - index`, () => {
'', // empty line for spacing
];

expect(consoleLogOutput).not.toHaveBeenCalled();
expect(consoleErrorOutput).toHaveBeenCalledTimes(
expectedMessages.length + 1,
);

expect(consoleErrorOutput).toHaveBeenCalledTimes(expectedMessages.length);
expect(consoleErrorOutput).toHaveBeenCalledWith(
expect.stringContaining('Please update the version number'),
);

expectedMessages.forEach(msg =>
expect(consoleErrorOutput).toHaveBeenCalledWith(msg),
Expand Down

0 comments on commit d4771b7

Please sign in to comment.