Skip to content

Commit

Permalink
test: Reduce test output noise (#53606)
Browse files Browse the repository at this point in the history
The errors, warnings, and logs from these tests are expected for each
test case. However, their presence creates noise the reduce the
comprehensibility of the test output. Intentionally suppressing them
simplifies the test output, making it easier to identify new, unexpected
console output.
  • Loading branch information
dcalhoun authored Aug 14, 2023
1 parent 5ecdba8 commit 5a238f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import {

setupCoreBlocks();

beforeEach( () => {
// Intentionally suppress the expected console errors and warnings to reduce
// noise in the test output.
jest.spyOn( console, 'error' ).mockImplementation( () => {} );
jest.spyOn( console, 'warn' ).mockImplementation( () => {} );
} );

describe( 'Block invalid warning', () => {
it( 'shows invalid placeholder', async () => {
// Arrange
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/embed/test/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ beforeEach( () => {
MOCK_EMBED_PHOTO_SUCCESS_RESPONSE,
MOCK_BAD_EMBED_PROVIDER_RESPONSE,
] );

// Intentionally suppress the expected console logs to reduce noise in the
// test output.
jest.spyOn( console, 'log' ).mockImplementation( () => {} );
} );

afterAll( () => {
Expand Down

0 comments on commit 5a238f9

Please sign in to comment.