Git Product home page Git Product logo

Comments (7)

yannbf avatar yannbf commented on May 29, 2024 1

Hey peeps! I'm closing this ticket given that direct MDX support is not in our plans. You can achieve your tests by using --stories-json or --index-json (if you're using newer versions of test-runner). Thank you!

from test-runner.

shilman avatar shilman commented on May 29, 2024

@bodograumann is there a stories.json file when you browse <your_sb_url>/stories.json? that should be a valid workaround for MDX stories, so if it's not working I'd love to get to the bottom of it.

from test-runner.

bodograumann avatar bodograumann commented on May 29, 2024

Indeed, @shilman, I have enabled the buildStoriesJson feature flag to get the stories.json (not storyStoreV7 though).
There was a change in the output, but still no tests were found apparently.

Without --stories-json:

> npm run storybook:test           

> [email protected] storybook:test
> test-storybook

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /home/bodo/my-app
  323 files checked.
  testMatch: **/*.stories.[jt]s?(x) - 0 matches
  testPathIgnorePatterns: /node_modules/ - 323 matches
  testRegex:  - 0 matches
Pattern:  - 0 matches

With --stories-json:

> npm run storybook:test

> [email protected] storybook:test
> test-storybook -- --stories-json

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /home/bodo/my-app
  401 files checked.
  testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 8 matches
  testPathIgnorePatterns: /node_modules/ - 401 matches
  testRegex:  - 0 matches
Pattern: --stories-json|--config|/home/bodo/my-app/node_modules/@storybook/test-runner/test-runner-jest.config.js - 0 matches

from test-runner.

yannbf avatar yannbf commented on May 29, 2024

Hey @bodograumann is there a chance you're using v0.0.1? If so, can you try v0.0.2-next.4 and run the same command?

from test-runner.

yannbf avatar yannbf commented on May 29, 2024

BTW thank you a lot for trying this library! It's incredible how active you are around the storybook community and we really appreciate that!!

from test-runner.

bodograumann avatar bodograumann commented on May 29, 2024

Thank you for saying that, @yannbf ☺️

You were right with your guess. I had, kind of blindly, followed the installation instructions and of course gotten only version 0.0.1.
With 0.0.2-next.4 and using --stories-json the tests are all run ❀️.

I am leaving this ticket open for first-level mdx support, but for now this is already a good solution for us. πŸš€

from test-runner.

danspratling avatar danspratling commented on May 29, 2024

Are there any updates on this? I'm trying to test (local) stories from MDX files (accessibility & interactions)

The tests run within storybook fine, but don't run using test runner

I'm currently on v0.1.1

When I enable the buildStoriesJson flag in storybook/main.js it this throws an error when running storybook - without it I always get the above no stories found error

.../node_modules/file-system-cache/lib/common/Util.js:66
            throw new Error(`Failed to read cache value at: ${path}. ${error.message}`);

EDIT: I found a solution

In my case, this was because the storybook build was erroring.

Once I followed the instructions in this issue, it was fixed

storybookjs/storybook#18094

from test-runner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.