Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation]: Configure the testing framework for portable stories (With Jest) #26925

Open
PedroBarbosaSw opened this issue Apr 23, 2024 · 0 comments

Comments

@PedroBarbosaSw
Copy link

Describe the problem

On this guide to migrate the storyshots to the latest storybook version (for jest) the function getAllStoryFiles does not return the componentName that is needed but comparing with Vitest it does return it.

So my suggestion it is just to update the following function:

function getAllStoryFiles() {
  const storyFiles = glob.sync(
    path.join(__dirname, '../**/*.{stories,story}.{js,jsx,mjs,ts,tsx}'),
  );

  return storyFiles.map((filePath) => {
    const storyFile = require(filePath);
    + const componentName = path.basename(filePath).replace(/\.(stories|story)\.[^/.]+$/, '');
    return { filePath, storyFile, componentName }; // return the componentName
  });
}

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant