Skip to content

Commit

Permalink
update tests to show logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Brianzchen committed Mar 2, 2024
1 parent e32d767 commit d3447c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cli/src/commands/__tests__/runTests-test.js
Expand Up @@ -2,8 +2,10 @@
import {run} from '../runTests';
import {path} from '../../lib/node';

const runTest = async () => {
jest.spyOn(console, 'log').mockImplementation(jest.fn());
const runTest = async (mockConsole: boolean) => {
if (mockConsole) {
jest.spyOn(console, 'log').mockImplementation(jest.fn());
}
const args = {
testPatterns: ['regression-1385_v1.x.x'],
numberOfFlowVersions: 2, // this can be reduced to 1 when latest flow release is not ignored
Expand All @@ -19,12 +21,12 @@ describe('run-tests (command)', () => {
});

it("returns error code if $FlowExpectedError test doesn't fail", async () => {
const status = await runTest();
const status = await runTest(false);
expect(status).toEqual(1);
});

it('console logs about unused suppression', async () => {
await runTest();
await runTest(true);

const expectedError = `Unused suppression`;
const calls = ((console.log: any): JestMockFn<any, any>).mock.calls;
Expand Down

0 comments on commit d3447c4

Please sign in to comment.