Skip to content

[Bug]: Svelte 4 component testing not working #30862

Open
@ryanzec

Description

@ryanzec

Version

1.43.1

Steps to reproduce

clone this repo: https://github.com/ryanzec/edg-ui
run pnpm install
run pnpm test:components

Expected behavior

test should run

Actual behavior

error after code builds

✓ built in 8.15s

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-auto
  Could not detect a supported production environment. See https://kit.svelte.dev/docs/adapters to learn how to configure your app to run on the platform of your choosing
Error: ENOENT: no such file or directory, open '/Users/ryanzec/repositories/edg-ui/playwright/.cache/metainfo.json'
  1 did not run

To open last HTML report run:

  pnpm exec playwright show-report

 ELIFECYCLE  Command failed with exit code 1.

Additional context

I followed the guide on the website an initially I got an error when it tried to compile code with TS:

vite v5.2.11 building for production...
✓ 4 modules transformed.
RollupError: [vite-plugin-svelte] [plugin vite-plugin-svelte] src/lib/components/core/button/button.svelte (2:9): /Users/ryanzec/repositories/edg-ui/src/lib/components/core/button/button.svelte:2:9 Unexpected token

- Did you forget to add a TypeScript preprocessor? See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md for more information.
file: /Users/ryanzec/repositories/edg-ui/src/lib/components/core/button/button.svelte:2:9
 1 |  <script context="module" lang="ts">
 2 |    export enum ButtonVariant {
               ^
 3 |      FILLED = 'filled',
 4 |      WEAK = 'weak',

so I have to add in the sveltekit plugin to the playwright config but then I get this error.

Environment

System:
    OS: macOS 12.7.4
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 33.79 MB / 16.00 GB
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 9.0.6 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
  IDEs:
    VSCode: 1.89.0 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/experimental-ct-svelte: 1.44.0 => 1.44.0
    @playwright/test: 1.43.1 => 1.43.1

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