Jest: console.assert from Puppeteer showing up in terminal after upgrading to v22.3.0

Created on 15 Feb 2018  路  9Comments  路  Source: facebook/jest

Do you want to request a _feature_ or report a _bug_?

Bug

What is the current behavior?

console.assert from puppeteer is showing up in terminal when running tests.

image

What is the expected behavior?

The console.assert calls didn't show up in v22.1.4

Most helpful comment

@emilianionascu

yourproject/tests/something.test.js

console.assert = jest.fn();
describe('your Jest test suite start here', () => {
  test('your unit test (or whatever you are doing)', () => {
    // do something
  });
});

works for me.

All 9 comments

Would the recent changes to Console.js or buffered_console.js cause this?
https://github.com/facebook/jest/compare/v22.1.4...v22.3.0

Yeah, this is #5514. The one from Page.js:648 looks legit, but we should not print the stackframe if there's nothing to log in an assert.

@ranyitz mind taking a look?

@SimenB I agree, I will fix it later on today.

Thank you for the fix. Is there a new release coming for it or perhaps a way to disable the assertions until the official fix?

you should be able to do console.assert = jest.fn() in a setupfile

@SimenB could you be more specific? I'm rather new to Jest, trying to use it with Puppeteer in a regression testing suite. I've created a jest.config.js file and tried to set it there assuming that console.assert were global. That didn't work.

@emilianionascu

yourproject/tests/something.test.js

console.assert = jest.fn();
describe('your Jest test suite start here', () => {
  test('your unit test (or whatever you are doing)', () => {
    // do something
  });
});

works for me.

22.4.0 is released, btw, so this shouldn't be needed anymore

Oh, this wasn't closed.

5576

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rosiakr picture rosiakr  路  3Comments

mmcgahan picture mmcgahan  路  3Comments

StephanBijzitter picture StephanBijzitter  路  3Comments

paularmstrong picture paularmstrong  路  3Comments

jardakotesovec picture jardakotesovec  路  3Comments