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

Vitest: Create "Component Coverage" per story file #28628

Closed
Tracked by #28608
valentinpalkovic opened this issue Jul 17, 2024 · 4 comments
Closed
Tracked by #28608

Vitest: Create "Component Coverage" per story file #28628

valentinpalkovic opened this issue Jul 17, 2024 · 4 comments

Comments

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Jul 17, 2024

We need to implement a mechanism in Vitest to generate coverage reports for each story file. This task focuses on collecting coverage data for all affected files when a story file is executed, and outputting the data in a parseable format. This will serve as the foundation for integrating coverage data into the Storybook UI or server at a later stage.

Tasks:

Configure Vitest for Coverage Reporting:

  • Set up Vitest to collect coverage data for story files.
  • Ensure that the configuration includes all necessary options for detailed coverage metrics (statements, branches, functions, lines).

Generate Coverage Reports:

Modify the Vitest configuration to generate coverage reports in a parseable format (e.g., JSON, LCOV).
Ensure the reports include detailed coverage information for all affected files related to the story file being tested.

(Optional) Save Coverage Data:

Implement a mechanism to save the generated coverage reports in a structured format in a predefined directory.
Ensure the saved data is organized and accessible for later use.

Documentation:

Document the process and configuration steps required to generate coverage reports with Vitest.
Provide examples of the generated coverage data format for reference.

Acceptance Criteria:

  • Vitest is configured to collect and generate detailed coverage reports for each story file.
  • Coverage reports are outputted in a parseable format (e.g., JSON, LCOV) and saved in a predefined directory.
  • The process and configuration steps are documented clearly, with examples of the coverage data format.
Copy link
Contributor

greptile-apps bot commented Jul 17, 2024

** Disclaimer** This information might be inaccurate, due to it being generated automatically

  1. Modify summarizeIndex in /code/core/src/core-server/utils/summarizeIndex.test.ts to include component coverage data.
  2. Create a new utility function similar to extractComponentDescription in /code/renderers/svelte/src/docs/extractComponentDescription.test.ts to extract component coverage information.
  3. Update CLI tools in /code/lib/cli-storybook and /code/lib/cli-sb to support the new component coverage feature.

References

/code/core/src/core-server/utils/summarizeIndex.test.ts
/code/renderers/svelte/src/docs/extractComponentDescription.test.ts
/code/lib/cli-storybook
/code/lib/cli-sb

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@valentinpalkovic
Copy link
Contributor Author

Completed. Except of the optional "(Optional) Save Coverage Data" requirement.

@foxaltus
Copy link

Any docs on this or still too early?

@valentinpalkovic
Copy link
Contributor Author

This was just an experimental spike. We haven't released any coverage addon (yet). We might have plans for the end of year or the beginning of next year, though.

@shilman Can provide more information about an approx. release date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants