playwright: [Question] Can someone help with Unknown file extension ".svelte" error for component test?
Context:
- Playwright Version: 1.25.1
- Operating System: Ubuntu 22.04.1 (WSL2 - Windows 11)
- Node.js version: 16.17.0
- Browser: All
- Extra: SvelteKit
Hi guys, can someone help with the issue below? I’m not used to Javascript/Node or anything related to frontend.
I have this project (for study) with KoaJS for the backend, SvelteKit for the frontend and Playwright to do all API/E2E/Component tests.
I tried to setup the Component Test for the Button.svelte component but here is the error is occurring. Thanks in advance.
> git clone https://github.com/ltsuda/learning-tests.git
> git switch test/initial-component
> npm i
> npx playwright install
> npm run test-ct
> learning-tests@1.0.0 test-ct
> playwright test -c playwright-ct.config.js
Running 0 tests using 0 workers
TypeError: Unknown file extension ".svelte" for /home/ltsuda/developer/learning-tests/frontend/src/components/button/Button.svelte
at async Promise.all (index 1)
=================
no tests found.
=================
1 error was not a part of any test, see above for details
To open last HTML report run:
npx playwright show-report
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (10 by maintainers)
Hi, SvelteKit maintainer here
We do use
@sveltejs/vite-plugin-svelte, but also use other plugins as well. The problem withctViteConfigis that you’re going to end up missing all the configuration that’s in thevite.config.jsandsvelte.config.js, which is what appears to be happening here.I wouldn’t do that, but just use the user’s
vite.config.jswhich already has all the plugins setup. You may need to remove one of our plugins if it takes over the build, but I would try to avoid adding any configuration of your own. See my comment here: https://github.com/microsoft/playwright/issues/18825#issuecomment-1421523694SvelteKit is stable now 🤩 Would love component testing support
you can try to use
npm init playwright@latest -- --ctto generate the config. see hereand you can add vite config here instead of vite.config.js