Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types resolution fails when importing jest types from @jest/globals #601

Closed
mulekick opened this issue Oct 19, 2024 · 1 comment
Closed

Comments

@mulekick
Copy link
Contributor

🐛 Bug Report

Native types resolution for jest-puppeteer is not supported if jest types are imported with @jest/globals.

To Reproduce

  1. Follow the installation procedure detailed in the "Getting started" section of jest-puppeteer README.
  2. Complete the specific setup steps for typescript detailed in "Troubleshooting/TypeScript".
  3. Uninstall @types/jest and write a test that relies on explicit imports from @jest/globals for types resolution.
  4. Types resolution fails : expect-puppeteer matchers are flagged as nonexistent by typescript.

Types resolution fails

  1. If we try to import expect from expect-puppeteer instead of @jest/globals, the native jest matchers are then flagged as nonexistent.

Expected behavior

Types resolution for expect-puppeteer matchers should work consistently whether the user chooses to import jest types from @types/jest or @jest/globals.

Link to repl or repo (highly encouraged)

Repo here

Issues without a reproduction link are likely to stall.

Run npx envinfo --system --binaries --npmPackages expect-puppeteer,jest-dev-server,jest-environment-puppeteer,jest-puppeteer,spawnd --markdown --clipboard

Paste the results here:

## System:
 - OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
 - CPU: (6) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
 - Memory: 3.65 GB / 7.75 GB
 - Container: Yes
 - Shell: 5.2.15 - /bin/bash
## Binaries:
 - Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
 - npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
## npmPackages:
 - expect-puppeteer: ^10.1.2 => 10.1.2 
 - jest-environment-puppeteer: ^10.1.2 => 10.1.2 
 - jest-puppeteer: ^10.1.2 => 10.1.2 
@gregberge
Copy link
Member

Fixed in #602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants