testing-library / pptr-testing-library

puppeteer + dom-testing-library = 💖
MIT License
287 stars 29 forks source link

Typescript Check error - TS2307 Cannot find module 'pptr-testing-library' #80

Closed vkyt closed 1 year ago

vkyt commented 1 year ago

We keep running into the following typescript error with import statement from the pptr-testing-library package.

The test runs fine but it can't get past the type check -

error TS2307: Cannot find module 'pptr-testing-library' or its corresponding type declarations.

I've tried changing the moduleResolution in tsconfig to node or nodenext, and tried multiple different module settings (commonjs/esnext/nodenext). I've even tried adding the pptr-testing-library as a dev dependency in the hopes that this issue could be related but none of the suggestions made any difference.

Any help is really appreciated as I'm at wits end.

puppeteer version: 13.5.2 jest-circus version: 26.6.3 jest-environment-node: 26.6.2

patrickhulce commented 1 year ago

Thanks for filing!

Can you clarify the reproduction steps and what specific commands are failing, including the version of pptr-testing-library you're using? It sounds like your tsconfig is just having trouble finding our typedefs, but I'm not certain from this description alone.

vkyt commented 1 year ago

Thanks for the quick response! I'll try to re-create the scenario with a test repo and share the repro here soon.

vkyt commented 1 year ago

Looks like the issue had to do with the directory hierarchy from which we're running the tsc type check - once I moved the pptr-testing-library dependency into the root directory where we're checking the types from, the issue resolved itself. Closing the issue as it's not really a problem with the library.