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

"Module expect-puppeteer in the setupFilesAfterEnv option was not found." with Jest v25 #322

Closed
jimmydief opened this issue Feb 24, 2020 · 1 comment · Fixed by #335
Closed
Labels

Comments

@jimmydief
Copy link
Contributor

🐛 Bug Report

Encountering an error with this module's config after upgrading Jest. I suspect that this could be fixed by explicitly requive.resolveing the path of expect-puppeteer from within the preset. In my case, expect-puppeteer is not used elsewhere and thus doesn't exist in my root node_modules folder which I suspect is the issue. This was potentially caused by the Jest 25 bug fix to start honoring setupFilesAfterEnv values from presets (jestjs/jest#7724).

To Reproduce

Steps to reproduce the behavior:

  1. Upgrade to Jest v25.1.0.
  2. Run existing tests with preset: 'jest-puppeteer' in config.
  3. Encounter error below:
 Validation Error:

  Module expect-puppeteer in the setupFilesAfterEnv option was not found.
         <rootDir> is: <REDACTED>

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

Expected behavior

Tests should run as expected.

Link to repl or repo (highly encouraged)

I can create one if desired.

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: macOS 10.15.3
 - CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
 - Memory: 132.53 MB / 16.00 GB
 - Shell: 5.7.1 - /usr/local/bin/zsh
## Binaries:
 - Node: 8.11.1 - /usr/local/bin/node
 - Yarn: 1.17.3 - /usr/local/bin/yarn
 - npm: 5.6.0 - /usr/local/bin/npm
 - Watchman: 4.9.0 - /usr/local/bin/watchman
## npmPackages:
 - jest-environment-puppeteer: 4.4.0 => 4.4.0
 - jest-puppeteer: 4.4.0 => 4.4.0
@jimmydief
Copy link
Contributor Author

This seems to only happen when npm installs expect-puppeteer inside of a nested node_modules directory inside of jest-puppeteer – I'm not sure under what circumstances that happens. An easy workaround is adding an explicit dependency on expect-puppeteer.

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

Successfully merging a pull request may close this issue.

2 participants