Silence console logs in individual tests to prevent spam (#41363)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41363

TSIA

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D51070939

fbshipit-source-id: 0d764b1e8a7594b7ee795a00349595d72e071cbf
This commit is contained in:
Moti Zilberman
2023-11-07 11:16:02 -08:00
committed by Facebook GitHub Bot
parent 7f82e16c7d
commit 0614479042
6 changed files with 21 additions and 3 deletions
@@ -16,6 +16,10 @@ jest.mock('child_process', () => ({spawnSync: jest.fn()}));
jest.mock('../for-each-package', () => jest.fn());
describe('findAndPublishAllBumpedPackages', () => {
beforeEach(() => {
// Silence logs.
jest.spyOn(console, 'log').mockImplementation(() => {});
});
it('throws an error if updated version is not 0.x.y', () => {
const mockedPackageNewVersion = '1.0.0';
@@ -60,6 +60,9 @@ describe('getAndUpdatePackages', () => {
}
return '';
});
// Silence logs.
jest.spyOn(console, 'log').mockImplementation(() => {});
});
it('Publishes the nightly version', () => {
@@ -25,6 +25,9 @@ describe('removeNewArchFlags', () => {
jest.resetAllMocks();
});
it('throws an exception if not run from react-native-github', async () => {
// Silence logs.
jest.spyOn(console, 'log').mockImplementation(() => {});
jest.spyOn(process, 'cwd').mockReturnValue('/path/to/react-native');
expect(removeNewArchFlags).toThrow();
});