React-testing-library: v10.0.2 pulling incorrect dom types

Created on 16 Apr 2020  路  4Comments  路  Source: testing-library/react-testing-library

  • @testing-library/react version: 10.0.2
  • react version: 16.9.0
  • node version: 10.15.3
  • npm (or yarn) version: yarn 1.6.0

What you did:

I updated @testing-library/react to latest in my project (using typescript)

Problem description:

The version of the code is fine, but @types/testing-library__dom are still on version 6.0.1 and not the latest 7 (missing screen, waitFor...etc.)

Screenshot 2020-04-16 at 09 21 04

Problem solution:

This * in dependencies, seems to be pulling version 6
https://unpkg.com/browse/@types/testing[email protected]/package.json

Or at least this is what my yarn.lock says.

Screenshot 2020-04-16 at 09 27 26

Most helpful comment

Remove yarn.lock

Don't do that. This might cause cascading issues. Unless you have a solid test suite you should only selectively upgrade your dependencies. Search for the entries that resolve the specific dependency and remove that entry e.g.

79433049-8df23600-7fc4-11ea-9d69-a1d2eb5aa01f

All 4 comments

Removing the lockfile entries for the @types/testing-library__* packages and running yarn install should pull in the latest versions. See #620 for more context.

Newly installed node_modules and fresh yarn.lock seem to make this work now.

All you have to do:

  • Remove node_modules/
  • Remove yarn.lock
  • Run yarn

Hope this is useful to someone, as I've spent quit a bit of time now debugging what was going on.

Removing the lockfile entries for the @types/testing-library__* packages and running yarn install should pull in the latest versions. See #620 for more context.

Thank you! I discovered that myself as well. Tried everything till I came up with that.

Remove yarn.lock

Don't do that. This might cause cascading issues. Unless you have a solid test suite you should only selectively upgrade your dependencies. Search for the entries that resolve the specific dependency and remove that entry e.g.

79433049-8df23600-7fc4-11ea-9d69-a1d2eb5aa01f

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AirborneEagle picture AirborneEagle  路  3Comments

jalvarado91 picture jalvarado91  路  3Comments

nagacoder picture nagacoder  路  3Comments

good-idea picture good-idea  路  4Comments

suresh777 picture suresh777  路  3Comments