You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to specify additional babel plugins to be passed in for transforming test files. Essentially, I'd like to be able to add to this array:
Currently, via playwright config use.ctViteConfig.plugins I can specify babel plugins to be used for transforming my app code, but there is no way to specify this for test files.
It may be a good idea to add a way to specify babel plugins to the playwright config which applies to both my app code and the test files?
Example
I'm trying to set up playwright component tests for a project using lingui for localisation. This makes use of macros which requires a babel plugin to transform.
Writing a test for a component that uses a lingui macro is fine, as I can specify babel plugin via use.ctViteConfig.plugins.
Writing a test that directly uses a lingui macro is not fine, as I cannot specify the babel plugin to use.
Motivation
Currently, if additional babel plugins are required to transform test files, the only way I can see is via patch-package.
It's currently a bit misleading that additional babel plugins can be passed in via use.ctViteConfig.plugins but this applies only to app code. I appreciate that this functionality is not yet documented on https://playwright.dev/docs/test-components#introduction.
The text was updated successfully, but these errors were encountered:
@lucy-m Overall, we'd like the test files be as separate as possible from your app. This means, using browser-specific packages that require special transform goes against such a goal. That said, I'll leave this issue open to prioritization, in case it turns out to be a popular request.
🚀 Feature Request
I would like to be able to specify additional babel plugins to be passed in for transforming test files. Essentially, I'd like to be able to add to this array:
playwright/packages/playwright-ct-core/index.js
Lines 28 to 30 in 42ade54
Currently, via playwright config
use.ctViteConfig.plugins
I can specify babel plugins to be used for transforming my app code, but there is no way to specify this for test files.It may be a good idea to add a way to specify babel plugins to the playwright config which applies to both my app code and the test files?
Example
I'm trying to set up playwright component tests for a project using lingui for localisation. This makes use of macros which requires a babel plugin to transform.
I've set up this repo with some example tests and explanation of the issues I'm facing https://github.com/lucy-m/playwright-lingui-repro.
The TLDR is:
use.ctViteConfig.plugins
.Motivation
Currently, if additional babel plugins are required to transform test files, the only way I can see is via patch-package.
It's currently a bit misleading that additional babel plugins can be passed in via
use.ctViteConfig.plugins
but this applies only to app code. I appreciate that this functionality is not yet documented on https://playwright.dev/docs/test-components#introduction.The text was updated successfully, but these errors were encountered: