Skip to content

[bug] act-compat assume console.error is called with a string #442

Closed
@SBoudrias

Description

@SBoudrias
  • react-testing-library version:
  • react version:
  • node version:
  • npm (or yarn) version:

Relevant code or config:

Code is situated here: https://github.com/testing-library/react-testing-library/blob/master/src/act-compat.js#L32

args[0].indexOf(
              'Warning: Do not await the result of calling ReactTestUtils.act',
            ) === 0

This assumes the first arg passed to console.error is a string; but the type could be different. For example, it can be an object console.error({ error })

Suggested solution:

We could either:

  1. Stringify the args before calling indexOf
  2. Type check the arg first

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions