[Feature] Use existing vite.config.js file for component tests
See original GitHub issueI have a project that already uses Vite, and is configured with the vite-tsconfig-paths plugin to resolve my paths correctly. It looks like Playwright’s new component testing feature doesn’t use my existing vite.config.js
file as it errors when trying to resolve a path that needs to follow my tsconfig path resolution logic.
It’d be nice if Playwright could make use of my custom config and just extend it to point to the correct entry
point (e.g. playwright/index.html
), or at least allow for configuring extra plugins for Playwright’s vite config to work correctly.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Configuring Vite
When running vite from the command line, Vite will automatically try to resolve a config file named vite.config.js inside project root.
Read more >Testing Vite with minimal config using Vitest - LogRocket Blog
js file as our website's entry point, it crawls HTML files to track all JavaScript, styles, and miscellaneous assets you use. This enables...
Read more >Testing with Vitest - This Dot Labs
Vitest is a new testing framework powered by Vite. It's still in development, and some features may not be ready yet, but it's...
Read more >Configuring Vitest
To configure vitest itself, add test property in your Vite config. ... When using a separate vitest.config.js , you can also extend Vite's...
Read more >Getting Started with Vitest | Vue Mastery
It uses the Vite dev server to transform your files during testing and listens to the same configuration of your app (through ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Had the same problem, some of my configurations applied, and some did not. I’ve written my custom vite plugin and defined there
config
function:It helped.
It’s not yet documented[^1], but you can explicitly configure the config (along with a few other options) via: https://github.com/microsoft/playwright/blob/fbb364c1cd0dec9e4a75b885d51e67ca397b1d6a/packages/playwright-ct-react/index.d.ts#L33
Give it a try and let us know how it goes! If you encounter any issues or have questions, feel free to comment here or open up another issue.
[^1]: Since we announced the feature as a preview, we have not yet given the docs the ❤️ they deserve…yet!