Skip to content

Jest 27 supportΒ #665

@flunderpero

Description

@flunderpero

Describe the bug
I am trying to use jest-playwright with Jest 27 and get this error:

TypeError: virtualMocks.get is not a function

      at Resolver._getVirtualMockPath (../../node_modules/jest-resolve/build/index.js:447:25)

To Reproduce
I am using a standard installation and a single simple test that just opens a browser.

Desktop (please complete the following information):

  • OS: [macOS M1]
  • Playwright version [1.10.0]
  • jest-playwright version [1.5.1]
  • jest version [27.0.0-next.7]

Jest configuration (Either in the package.json > jest or in the jest.config.js):

module.exports = {
   globals: {
       "ts-jest": {
           diagnostics: false,
           isolatedModules: true,
       },
   },
   moduleDirectories: ["<rootDir>/../../node_modules"],
   moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
   moduleNameMapper: {
       "\\.css$": "identity-obj-proxy",
       "\\.scss$": "identity-obj-proxy",
       "^@cling/(.*)$": "<rootDir>/../$1",
   },
   reporters: ["default"],
   setupFilesAfterEnv: ["<rootDir>/../lib.shared.test/jest_setup.ts"],
   snapshotSerializers: [],
   preset: "jest-playwright-preset",
   testMatch: ["<rootDir>/__tests__/**/*.spec.ts?(x)"],
   transform: {"^.+\\.tsx?$": "ts-jest"},
}

This is a sub-project in a monorepo. But even if I use jest-playwright-preset in the main configuration it won't work.

Additional context
All's working fine with Jest 26.6.3

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