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

[Breaking Change]: Replace babel-istanbul-plugin and replace it by a webpack loader #27

Merged
merged 6 commits into from
Nov 14, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Oct 24, 2023

Closes #29
Closes #17
Closes #21
Closes #25

What Changed

The babel-istanbul-plugin was replaced by a custom webpack loader to enable support for all Webpack5 projects, independently, whether they are using Babel as a compiler or another solution, like SWC

Release Notes

  • [BREAKING CHANGE]: Dropping Storybook < 7 support
  • Replaced babel-istanbul-plugin with a custom Webpack loader to support coverage independently of the compiler used for Webpack5 projects. Before, the coverage addon only worked if Babel was used with Webpack5. Now, users might use other compilers like, for example, SWC.
📦 Published PR as canary version: 1.0.0-canary.27.12a4851.0

✨ Test out this PR locally via:

npm install @storybook/addon-coverage@1.0.0-canary.27.12a4851.0
# or 
yarn add @storybook/addon-coverage@1.0.0-canary.27.12a4851.0

@yannbf yannbf added the minor Increment the minor version when merged label Oct 24, 2023
@yannbf yannbf force-pushed the feat/support-webpack-swc branch 4 times, most recently from 86a1d28 to e56d027 Compare October 25, 2023 13:17
Copy link

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@sebaguozden
Copy link

sebaguozden commented Nov 6, 2023

@kasperpeulen @yannbf I tried this with an app created using pnpm create vite (React -> TypeScript + SWC) and I can't get coverage correctly (#28)

@valentinpalkovic valentinpalkovic added major Increment the major version when merged do not merge and removed minor Increment the minor version when merged do not merge labels Nov 9, 2023
@valentinpalkovic valentinpalkovic changed the title Experimental: Support SWC and Webpack [Breaking Change]: Replace babel-istanbul-plugin and replace it by a webpack loader Nov 10, 2023
@valentinpalkovic valentinpalkovic merged commit cced79d into main Nov 14, 2023
3 checks passed
@taozhou-glean
Copy link

taozhou-glean commented Dec 5, 2023

how should I expect to run the coverage on the webpack5 example folder ?

I am getting following errors:


Test Suites: 3 failed, 3 total
Tests:       8 failed, 8 total
Snapshots:   0 total
Time:        1.416 s
Ran all test suites.
Coverage file (2 bytes) written to .nyc_output/coverage.json
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |
----------|---------|----------|---------|---------|-------------------

while yarn test-storybook works just fine

 PASS   browser: chromium  stories/Page.stories.tsx
 PASS   browser: chromium  stories/Button.stories.tsx
 PASS   browser: chromium  stories/Header.stories.tsx

Test Suites: 3 passed, 3 total
Tests:       8 passed, 8 total
Snapshots:   0 total
Time:        1.318 s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Increment the major version when merged
Projects
None yet
5 participants