I reckon that what you want to do is to run tests that are generated using playwright codegen with Jest.

However, this does not seem to be possible: The tests are generated with import { test, expect } from '@playwright/test' at the top, and this is the module that throws the error. The tests that are generated with Playwright use the API from this module, and this is slightly different than the one from Jest. (It gets fixtures as parameters).

If you use the implementation from Playwright (for instance by mocking away the throwIfRunningInsideJest function), it still won't work because then the tests won't be registered in the Jest test runner.

Answer from RolKau on Stack Overflow
🌐
QA Wiki
ray.run › rayrun › discord forum › jest tests clashing with playwright tests
Resolving Jest and Playwright Test Conflicts in Typescript/Next.js App
June 19, 2023 - When we added playwright we put the config at the root of our monorepo and just added all our tests into an e2e-tests folder. Then adding "e2e-tests" to our testPathIgnorePatterns setting in Jest made sure they never ran.
Discussions

[Question] @playwright/test - Ignore .tsx files when running tests
Asking this as a question rather than a bug report, as I hope I'm just doing something wrong in my configuration here. Was previously running Playwright tests via Jest, and am trying to switch ... More on github.com
🌐 github.com
15
January 28, 2022
typescript - How to ignore multiple spec files in playwright? - Stack Overflow
in my config i have 3 projects, one runs tests for a specific acc type using one login, the other runs tests for another login, and now ive just added a 3rd project that has to run tests for a spec... More on stackoverflow.com
🌐 stackoverflow.com
exclude default setting should exclude e2e tests folder
Clear and concise description of the problem Since a generally accepted good practice* is to put unit tests next to the code they test, and e2e tests in a separate folder, excluding such a folder w... More on github.com
🌐 github.com
20
March 29, 2023
@nx/playwright:configuration doesn't exclude e2e files from unit test config
Create a separate tsconfig file for e2e tests, and exclude e2e folder in tsconfig.spec.ts file. ... Add new playwright test to the repo by running nx g @nx/playwright:configuration --project=project-name · Create one simple test file inside of e2e folder with broken syntax (so it cannot be compiled by compiler) When running nx test, created file should throw a compile-time error · Node : 18.10.0 OS : darwin-arm64 npm : 8.19.2 nx (global) : 16.6.0 nx : 16.4.0 @nx/js : 16.4.0 @nx/jest ... More on github.com
🌐 github.com
4
January 23, 2024
🌐
GitHub
github.com › playwright-community › jest-playwright
GitHub - playwright-community/jest-playwright: Running tests using Jest & Playwright · GitHub
For that you have to use the -c flag when calling Jest and use the testMatch or testRegex in your Jest config to split them. Be sure to remove any existing testEnvironment option from your Jest configuration.
Starred by 542 users
Forked by 76 users
Languages   TypeScript 95.5% | JavaScript 4.0% | HTML 0.5%
🌐
Playwright
playwright.tech › blog › using-jest-with-playwright
Using Jest with Playwright - Playwright Community 🎭
May 28, 2020 - Also since this is a normal Jest configuration you can pass a RegExp or glob pattern which determines the files which Jest should run. It's useful to use e.g. a custom folder or file suffix as a naming convention to separate your unit tests from the end-to-end tests. See here as a reference for the testRegex and testMatch setting. For the basic configuration this is already enough to get started. If you want to setup custom browsers, devices, screen resolutions or other launch settings for Playwright, then you need a custom Playwright configuration.
🌐
GitHub
github.com › microsoft › playwright › issues › 11720
[Question] @playwright/test - Ignore .tsx files when running tests · Issue #11720 · microsoft/playwright
January 28, 2022 - { "compileOnSave": false, "compilerOptions": { "target": "es6", "module": "esnext", "jsx": "preserve", "allowJs": true, "moduleResolution": "node", "noUnusedParameters": true, "allowSyntheticDefaultImports": true, "preserveConstEnums": true, "sourceMap": true, "skipLibCheck": true, "baseUrl": ".", "paths": { "*": [ "types/*" ] }, "lib": [ "dom", "es2016" ], "strict": false, "forceConsistentCasingInFileNames": true, "noEmit": false, "noUnusedLocals": true, "esModuleInterop": true, "resolveJsonModule": true, "isolatedModules": true, "outDir": ".next/tsc-cache/", "incremental": true, "experimentalDecorators": true }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx" ], "exclude": [ "node_modules" ] }
Author   lararosekelley
🌐
Playwright
playwright.dev › configuration
Configuration | Playwright
import { defineConfig } from '@playwright/test'; export default defineConfig({ // Glob patterns or regular expressions to ignore test files. testIgnore: '*test-assets', // Glob patterns or regular expressions that match test files.
🌐
Amalitsky
lab.amalitsky.com › posts › 2022 › exclude-playwright-test-traffic-from-google-analytics
How to Exclude Playwright Test Traffic from Google Analytics | amlab
December 11, 2022 - localStorage is a persistent storage — if you add ga_debug_mode property in your browser’s JavaScript console, the setting will stick (for the active hostname). All subsequent sessions from that browser won’t get reported to Google Analytics! This is not a problem for Playwright tests, since an isolated browser context is created for every test.
Find elsewhere
🌐
Storybook
storybook.js.org › docs › writing-tests › test-runner
Storybook: Frontend workshop for UI development
To avoid this, make sure the tags ... and exclude lists differ. If you've enabled the test-runner in a project running on a newer version of Yarn with Plug'n'Play (PnP) enabled, the test-runner might not work as expected and may generate the ...
🌐
GitHub
github.com › vitest-dev › vitest › issues › 3102
exclude default setting should exclude e2e tests folder · Issue #3102 · vitest-dev/vitest
March 29, 2023 - In many projects I see that all the configuration file does is modify include or exclude to exclude e2e tests.
Author   GermanJablo
🌐
Medium
medium.com › @saiyar.jo147th248 › understanding-playwright-and-jest-a-strategic-guide-for-effective-testing-9d58c37c89f8
Understanding Playwright and Jest: A Strategic Guide for Effective Testing | by Joe Gray | Medium
December 5, 2023 - In this blog, we embark on an in-depth exploration of Playwright vs. Jest. Our goal is to provide you with valuable insights, empowering you to make an informed decision that aligns with your specific JavaScript testing needs.
🌐
GitHub
github.com › nrwl › nx › issues › 21274
@nx/playwright:configuration doesn't exclude e2e files from unit test config · Issue #21274 · nrwl/nx
January 23, 2024 - Create a separate tsconfig file for e2e tests, and exclude e2e folder in tsconfig.spec.ts file. ... Add new playwright test to the repo by running nx g @nx/playwright:configuration --project=project-name · Create one simple test file inside ...
Author   kprekratbob
🌐
GitHub
github.com › valor-software › ng2-charts › actions › runs › 6000516401
Exclude playwright specs from jest tests · valor-software/ng2-charts@3233ab7
Beautiful charts for Angular based on Chart.js. Contribute to valor-software/ng2-charts development by creating an account on GitHub.
Author   valor-software
🌐
YouTube
youtube.com › watch
Exclude Specific Test Suites in playwright-jest with Ease - YouTube
Discover how to configure `playwright-jest` to exclude specific test suite files effectively using regex and command line arguments.---This video is based on...
Published   April 15, 2025
Views   0
🌐
Medium
vgcpaulino.medium.com › cross-browser-testing-with-jest-playwright-bb6e2758cdc
Cross-Browser Testing with Jest Playwright | by Vinicius Gabriel Cabral Paulino | Medium
May 15, 2021 - I challenge you to try, remove the Jest Playwright from the Jest config, and then run the following test (one at a time).
🌐
Reddit
reddit.com › r/qualityassurance › jest vs playwright
r/QualityAssurance on Reddit: Jest vs Playwright
October 27, 2021 -

Hi everyone! I'm in charge of deciding which automation frameworks we should use at our company. For QA, I want them to use Playwright Test Runner + Playwright, esp since they have webkit (and a lot of our users use both Chrome and Safari), but our eng team already uses Jest for all of their unit tests.

Would it be better to do Jest + Playwright (to remain consistent with the rest of eng team) or do Playwright Test Runner + Playwright (since it's already similar to Jest and does a lot more than Jest from a QA's perspective)?

And if we should do the latter, then should we just let the eng team continue with Jest? I'm just not sure what to do so if anyone can give some advice about this, that would be great! Thank you!

🌐
Lemon.io
lemon.io › home › questions and answers › jest › what is the difference between jest and playwright?
What is the difference between Jest and Playwright? - Lemon.io
December 11, 2024 - Jest is designed for unit and integration testing, focusing on JavaScript code and application logic. Playwright, on the other hand, is a tool for end-to-end testing, enabling developers to test how applications perform across different browsers and devices.