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

Regression: injectGlobals:false no longer supported ("Cannot convert undefined or null to object") #564

Open
fregante opened this issue Sep 14, 2023 · 1 comment

Comments

@fregante
Copy link

fregante commented Sep 14, 2023

πŸ› Bug Report

I'm trying to update Puppeteer, jest-puppeteer and expect-puppeteer to their latest versions and I'm encountering this issue:

 FAIL  test/browser.js
  ● Test suite failed to run

    TypeError: Cannot convert undefined or null to object
        at Function.keys (<anonymous>)

      at Object.<anonymous> (node_modules/expect-puppeteer/dist/index.js:505:8)

The issue appears to happen here:

Object.keys(jestExpect).forEach((prop) => {

because jestExpect is undefined

To Reproduce

# Check out https://github.com/fregante/webext-dynamic-content-scripts/pull/63/commits/b428a7823f6317b5f508304f5893e061514967e2

npm install -D jest-puppeteer@latest expect-puppeteer@latest
npm run jest

The same also happens when upgrading to puppeteer 21 without updating those two dependencies.

Expected behavior

The tests should pass (or at least not throw in expect-puppeteer)

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 13.4.1
 - CPU: (16) x64 Intel(R) Core(TM) i9
 - Memory: 2.44 GB / 16.00 GB
 - Shell: 3.6.1 - /usr/local/bin/fish
## Binaries:
 - Node: 20.6.1 - /usr/local/bin/node
 - Yarn: 1.22.11 - /usr/local/bin/yarn
 - npm: 10.1.0 - /usr/local/bin/npm
## npmPackages:
 - expect-puppeteer: ^9.0.0 => 9.0.0 
 - jest-puppeteer: ^9.0.0 => 9.0.0 
@fregante fregante changed the title Cannot convert undefined or null to object Regression: injectGlobals:false no longer supported ("Cannot convert undefined or null to object") Sep 14, 2023
@fregante
Copy link
Author

If I drop jest.injectGlobals: false from my package.json, v9 works again. It would be great to restore support for this

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

1 participant