Skip to content

Commit

Permalink
fix(amplify-provider-awscloudformation): fix test (#6955)
Browse files Browse the repository at this point in the history
This test was failing locally because the output contained
colors that are not present in the assertion logic.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>
  • Loading branch information
cjihrig and cjihrig-aws authored Mar 25, 2021
1 parent f51b6af commit 27030ea
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ import columnify from 'columnify';
const printer: IStackProgressPrinter = new StackProgressPrinter();
jest.mock('columnify');

// Make sure that chalk colors are stripped for the test.
function chalkMock(input) {
if (input instanceof Date) {
return input.toString();
}

return input;
}

jest.mock('chalk', () => ({
green: jest.fn().mockImplementation(chalkMock),
red: jest.fn().mockImplementation(chalkMock),
reset: jest.fn().mockImplementation(chalkMock),
}));

describe('StackProgressPrinter', () => {
test('print events order by Timestamp', () => {
printer.addActivity({
Expand Down

0 comments on commit 27030ea

Please sign in to comment.