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

Addon Test: Clear coverage data when starting or watching #30072

Merged
merged 19 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e1f59e9
Clear coverageSummary when disabling the coverage feature
ghengeveld Dec 13, 2024
51ab99b
Build: Add text suggestions for incorrect task names
yannbf Dec 13, 2024
77f94d9
Update exclude details
kylegach Dec 13, 2024
39259b3
Remove mention of Vitest prompting of coverage support pkgs
kylegach Dec 13, 2024
25545c2
Write changelog for 8.5.0-alpha.22 [skip ci]
storybook-bot Dec 13, 2024
7ef7a0e
Bump version from "8.5.0-alpha.21" to "8.5.0-alpha.22" [skip ci]
storybook-bot Dec 13, 2024
b57db9e
Build: Improve waiting detection on E2E to fix flake
yannbf Dec 13, 2024
a57336a
add deps optimization in react kitchen sink
yannbf Dec 13, 2024
a48c774
improve story loading
yannbf Dec 13, 2024
87daadd
Refactor addonA11yAddonTest to improve setup file transformation and …
valentinpalkovic Dec 13, 2024
fe9fc42
Build: Refactor e2e test for composition to make it more stable
valentinpalkovic Dec 15, 2024
377493e
Build: Update GitHub Actions workflow to set fetch-depth for improved…
valentinpalkovic Dec 15, 2024
6180caa
Build: Add verbose flag to compile commands for better output clarity
valentinpalkovic Dec 15, 2024
86a5191
Update NX
valentinpalkovic Dec 15, 2024
861c7c3
NX: Use legacy cache
valentinpalkovic Dec 15, 2024
8622881
Remove verbose flag from nx build commands
valentinpalkovic Dec 15, 2024
cf1e4a7
Next.js: Support v15.1
valentinpalkovic Dec 15, 2024
0ca7b7c
Clear coverageSummary when starting test run or enabling watch mode
ghengeveld Dec 16, 2024
fc703e2
Merge branch 'next' into clear-coverage-on-start
ghengeveld Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set node version
uses: actions/setup-node@v4
with:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 8.5.0-alpha.22

- Addon Docs: Dynamically import rehype - [#29544](https://github.com/storybookjs/storybook/pull/29544), thanks @valentinpalkovic!
- Addon Test: Fix duplicate `test.include` patterns - [#30029](https://github.com/storybookjs/storybook/pull/30029), thanks @JReinhold!
- Addon Test: Fix environment variable for Vitest Storybook integration - [#30054](https://github.com/storybookjs/storybook/pull/30054), thanks @valentinpalkovic!
- Addon Test: Use local storybook binary instead - [#30021](https://github.com/storybookjs/storybook/pull/30021), thanks @kasperpeulen!
- Addon Test: Wait for 2 seconds before showing result mismatch warning - [#30002](https://github.com/storybookjs/storybook/pull/30002), thanks @ghengeveld!
- Angular: Support statsJson in angular schemas - [#29233](https://github.com/storybookjs/storybook/pull/29233), thanks @yannbf!
- Core: Fix `scrollIntoView` behavior and reimplement testing module time rendering - [#30044](https://github.com/storybookjs/storybook/pull/30044), thanks @ghengeveld!
- Docs: Add code snippet to addons panel - [#29253](https://github.com/storybookjs/storybook/pull/29253), thanks @larsrickert!
- Next.js: Fix webpack fsCache not working - [#29654](https://github.com/storybookjs/storybook/pull/29654), thanks @sentience!
- Nextjs-Vite: Add TS docgen support - [#29824](https://github.com/storybookjs/storybook/pull/29824), thanks @yannbf!
- Nextjs-Vite: Fix docgen types in main config - [#30042](https://github.com/storybookjs/storybook/pull/30042), thanks @yannbf!
- React: Fix RSC compatibility with addon-themes and hooks - [#26243](https://github.com/storybookjs/storybook/pull/26243), thanks @shilman!
- UI: Fix controls and parameters on tag-filtered stories - [#30038](https://github.com/storybookjs/storybook/pull/30038), thanks @shilman!

## 8.5.0-alpha.21

- Addon A11y: Add typesVersions support for TypeScript definitions in a11y package - [#30005](https://github.com/storybookjs/storybook/pull/30005), thanks @valentinpalkovic!
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-a11y",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Test component compliance with web accessibility standards",
"keywords": [
"a11y",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Get UI feedback when an action is performed on an interactive element",
"keywords": [
"storybook",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-backgrounds",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Switch backgrounds to view components in different settings",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-controls",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Interact with component inputs dynamically in the Storybook UI",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-docs",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Document component usage and properties in Markdown",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/essentials/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-essentials",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Curated addons to bring out the best of Storybook",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/gfm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-mdx-gfm",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "GitHub Flavored Markdown in Storybook",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/highlight/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-highlight",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Highlight DOM nodes within your stories",
"keywords": [
"storybook-addons",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/interactions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-interactions",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Automate, test and debug user interactions",
"keywords": [
"storybook-addons",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-jest",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "React storybook addon that show component jest report",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-links",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Link stories together to build demos and prototypes with your UI components",
"keywords": [
"storybook-addons",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/measure/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-measure",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Inspect layouts by visualizing the box model",
"keywords": [
"storybook-addons",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/onboarding/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-onboarding",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Storybook Addon Onboarding - Introduces a new onboarding experience",
"keywords": [
"storybook-addons",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/outline/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-outline",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Outline all elements with CSS to help with layout placement and alignment",
"keywords": [
"storybook-addons",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/storysource/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storysource",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "View a story’s source code to see how it works and paste into your app",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/experimental-addon-test",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Integrate Vitest with Storybook",
"keywords": [
"storybook-addons",
Expand Down
117 changes: 64 additions & 53 deletions code/addons/test/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,64 +73,75 @@ addons.register(ADDON_ID, (api) => {
},

stateUpdater: (state, update) => {
if (!update.details?.testResults) {
return;
const updated = {
...state,
...update,
details: { ...state.details, ...update.details },
};

if ((!state.running && update.running) || (!state.watching && update.watching)) {
// Clear coverage data when starting test run or enabling watch mode
delete updated.details.coverageSummary;
}
ghengeveld marked this conversation as resolved.
Show resolved Hide resolved
ghengeveld marked this conversation as resolved.
Show resolved Hide resolved

(async () => {
await api.experimental_updateStatus(
TEST_PROVIDER_ID,
Object.fromEntries(
update.details.testResults.flatMap((testResult) =>
testResult.results
.filter(({ storyId }) => storyId)
.map(({ storyId, status, testRunId, ...rest }) => [
storyId,
{
title: 'Component tests',
status: statusMap[status],
description:
'failureMessages' in rest && rest.failureMessages
? rest.failureMessages.join('\n')
: '',
data: { testRunId },
onClick: openTestsPanel,
sidebarContextMenu: false,
} satisfies API_StatusObject,
])
if (update.details?.testResults) {
(async () => {
await api.experimental_updateStatus(
TEST_PROVIDER_ID,
Object.fromEntries(
update.details.testResults.flatMap((testResult) =>
testResult.results
.filter(({ storyId }) => storyId)
.map(({ storyId, status, testRunId, ...rest }) => [
storyId,
{
title: 'Component tests',
status: statusMap[status],
description:
'failureMessages' in rest && rest.failureMessages
? rest.failureMessages.join('\n')
: '',
data: { testRunId },
onClick: openTestsPanel,
sidebarContextMenu: false,
} satisfies API_StatusObject,
])
)
)
)
);
);

await api.experimental_updateStatus(
'storybook/addon-a11y/test-provider',
Object.fromEntries(
update.details.testResults.flatMap((testResult) =>
testResult.results
.filter(({ storyId }) => storyId)
.map(({ storyId, testRunId, reports }) => {
const a11yReport = reports.find((r: any) => r.type === 'a11y');
return [
storyId,
a11yReport
? ({
title: 'Accessibility tests',
description: '',
status: statusMap[a11yReport.status],
data: { testRunId },
onClick: () => {
api.setSelectedPanel('storybook/a11y/panel');
api.togglePanel(true);
},
sidebarContextMenu: false,
} satisfies API_StatusObject)
: null,
];
})
await api.experimental_updateStatus(
'storybook/addon-a11y/test-provider',
Object.fromEntries(
update.details.testResults.flatMap((testResult) =>
testResult.results
.filter(({ storyId }) => storyId)
.map(({ storyId, testRunId, reports }) => {
const a11yReport = reports.find((r: any) => r.type === 'a11y');
ghengeveld marked this conversation as resolved.
Show resolved Hide resolved
return [
storyId,
a11yReport
? ({
title: 'Accessibility tests',
description: '',
status: statusMap[a11yReport.status],
data: { testRunId },
onClick: () => {
api.setSelectedPanel('storybook/a11y/panel');
api.togglePanel(true);
},
sidebarContextMenu: false,
} satisfies API_StatusObject)
: null,
];
})
)
)
)
);
})();
);
})();
}

return updated;
},
} as Addon_TestProviderType<Details, Config>);
}
Expand Down
2 changes: 1 addition & 1 deletion code/addons/themes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-themes",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Switch between multiple themes for you components in Storybook",
"keywords": [
"css",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/toolbars/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-toolbars",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Create your own toolbar items that control story rendering",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/viewport/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-viewport",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Build responsive components by adjusting Storybook’s viewport size and orientation",
"keywords": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion code/builders/builder-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/builder-vite",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "A plugin to run and build Storybooks with Vite",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-vite/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion code/builders/builder-webpack5/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/builder-webpack5",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
Expand Down
2 changes: 1 addition & 1 deletion code/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/core",
"version": "8.5.0-alpha.21",
"version": "8.5.0-alpha.22",
"description": "Storybook framework-agnostic API",
"keywords": [
"storybook"
Expand Down
Loading
Loading