Skip to content

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

@fregante

Description

@fregante

πŸ› 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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions