Skip to content

No extend-expect type definitions #40

Closed
@mbaranovski

Description

@mbaranovski
  • react-testing-library version: 1.9.3
  • node version: 9.2.1

What you did:
Created fresh project from CRA + typescript scripts and then wrote a simple test

test('renders App without crashing', () => {

  const { queryByTestId } = render(<App/>);

  expect(queryByTestId('app-hoc')).toBeInTheDOM();
});

What happened:
The test is passing but the project does not build. Throwing this error:

Property 'toBeInTheDOM' does not exist on type 'Matchers'.

Problem description:
Typescript won't allow building project when we are using property which does not exist on some particular type (Matchers in this case)

Suggested solution:
Extend jest expect typings with a new types definition for methods from extend-expect.js

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