Skip to content

[Feature]: Allow specifying custom export conditions in playwright test config #33684

@mrginglymus

Description

@mrginglymus

🚀 Feature Request

Add option to specifiy additional custom export conditions, analagous to jest's customExportConditions

Example

No response

Motivation

I currently use custom export specifiers to allow switching between raw and compiled sources within my library. This allows for speedy development against local sources with verification that the build process hasn't broken anything, without having to do import mapping in every different bit of tooling.

Currently, playwright does not appear support custom conditions for its test files in the experimental component testing libraries.

Whilst code under test can have this done, by setting:

export default {
  use: {
    ctViteConfig: {
      resolve: {
        conditions: [...]
      }
    }
  }
}

ie, the vite config, no such equivalent exists for the test files themselves.

I have tried launching playwright test with the NODE_OPTIONS env var set to -C <my_condition>; this however prevents yarn from resolving the playwright cli entrypoint:

Error: Cannot find module '...\AppData\Local\Yarn\Berry\cache\playwright-npm-1.49.0-d57440d7c1-10c0.zip\node_modules\playwright\cli.js'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions