Skip to content

[Question] Is Playwright Test using a custom CJS/ESM module system? #14398

@patricktree

Description

@patricktree

Hello!

I consider to use Playwright Test for unit&integration tests and I am currently reviewing what is missing compared to "traditional" unit test frameworks like Jest.
One thing Jest provides is an API to mock CJS modules loaded by the subject under test, via jest.mock(...). In essence, it is possible to replace the thing returned by require function calls.

Now I tried to set up testdouble in my Playwright Test setup to do the same thing, but I just can't get it to work.
So what I wonder is: Does Playwright Test use some sort of custom loader for CJS/ESM modules that prevents such module-mock libraries (like testdouble, proxyquire, etc.) to work?

Related: #14268

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