Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Not Able to Use jest-playwright-preset in Playwright Docker Container #793

@lifan0127

Description

@lifan0127

Describe the bug
The jest-playwright-preset package, when used in a playwright docker container, leads to TypeError: Class extends value #<Object> is not a constructor or null. It started to happen to me yesterday as all my CI tests are failing due to this error. I am not sure whether jest-playwright-preset or the playwright Docker image is contributing to this behavior.

To Reproduce
Use this minimal Docker file:

FROM mcr.microsoft.com/playwright:v1.21.0-focal

WORKDIR /app

RUN npm install jest-playwright-preset

CMD node -e "const { globalSetup: playwrightGlobalSetup } = require('jest-playwright-preset')"

Build the image and run it: docker build -t app . && docker run --rm app

Expected behavior
The following error message appeared:

/app/node_modules/jest-playwright-preset/lib/PlaywrightEnvironment.js:59
    return class PlaywrightEnvironment extends RootEnv {
                                               ^

TypeError: Class extends value #<Object> is not a constructor or null
    at Object.getPlaywrightEnv (/app/node_modules/jest-playwright-preset/lib/PlaywrightEnvironment.js:59:48)
    at Object.<anonymous> (/app/node_modules/jest-playwright-preset/lib/PlaywrightEnvironment.js:242:27)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/app/node_modules/jest-playwright-preset/index.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)

Desktop (please complete the following information):

  • OS: Ubuntu
  • Playwright version: 1.21.0
  • jest-playwright version: 1.7.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