storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
103 stars 32 forks source link

[Bug] Storybook test runner does not work with Svelte CSF addon #90

Closed jwerre closed 1 year ago

jwerre commented 1 year ago

Describe the bug

After installing @storybook/test-runner@0.10.0-next.3 and running it with ./node_modules/.bin/test-storybook it is unable to find any tests.

Steps to reproduce the behavior

  1. Install Storybook version 7
  2. $npm install --save-dev @storybook/test-runner@0.10.0-next.3 @storybook/testing-library
  3. Create a simple Button component Story component.
  4. Open button.stories.svelte, import @storybook/testing-library and add a test to the play function e.g.: play={ (args) => expect(true).toBe(true) }
  5. $npm run storybook
  6. $./node_modules/.bin/test-storybook

Expected behavior

Tests are expected to be found and run.

Screenshots and/or logs

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/home/Work/svelte_components
  30 files checked.
  testMatch: /Users/home/Work/svelte_components/src/**/*.mdx, /Users/home/Work/svelte_components/src/**/*.stories.@(js|jsx|ts|ts|svelte|tsx) - 0 matches
  testPathIgnorePatterns: /node_modules/ - 30 matches
  testRegex:  - 0 matches
Pattern:  - 0 matches

Environment

Additional context

I haven't tried this in Storybook 6 but I assume the result is the same. I've also tried to run this in a container with the same effect. If you deploy the Storybook and run test with a url flag the test work. e.g.: ./node_modules/.bin/test-storybook --url example.com. While this works it's not a great solution since test need to be deployed before tests can be run (which is kind of backwards).

jwerre commented 1 year ago

https://github.com/storybookjs/test-runner/issues/262