-
Notifications
You must be signed in to change notification settings - Fork 5
Migrate to new test provider API #367
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #367 +/- ##
========================================
+ Coverage 5.86% 6.00% +0.13%
========================================
Files 176 169 -7
Lines 14858 14272 -586
Branches 309 302 -7
========================================
- Hits 872 857 -15
+ Misses 13898 13333 -565
+ Partials 88 82 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/TestingModule.tsx
Outdated
let description: string | React.ReactNode; | ||
switch (true) { | ||
case !!warning: | ||
description = <Link onClick={clickWarning}>{warning}</Link>; | ||
break; | ||
case testProviderState === 'test-provider-state:running': | ||
description = localBuildProgress | ||
? BUILD_STEP_CONFIG[localBuildProgress.currentStep].renderProgress(localBuildProgress) | ||
: 'Starting...'; | ||
break; | ||
case !!isOutdated: | ||
description = 'Test results outdated'; | ||
break; | ||
case localBuildProgress?.currentStep === 'aborted': | ||
description = 'Aborted by user'; | ||
break; | ||
case localBuildProgress?.currentStep === 'complete': | ||
description = localBuildProgress.errorCount | ||
? `Encountered ${pluralize('component error', localBuildProgress.errorCount, true)}` | ||
: warningStatusCount | ||
? `Found ${pluralize('story', warningStatusCount, true)} with ${pluralize('change', warningStatusCount)}` | ||
: 'No visual changes detected'; | ||
break; | ||
default: | ||
description = 'Not run'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was essentially what the previous TestingModuleDescription
component used to return. now we're setting description
instead, and returning the JSX that LegacyRender
would return - but simplified as it doesn't need to be generalized anymore.
@@ -1,6 +1,3 @@ | |||
import * as coreEvents from 'storybook/internal/core-events'; | |||
import { experimental_getStatusStore } from 'storybook/manager-api'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was really bad, I don't know why I thought this was a good idea initially. Because the preset also imports from this constants
file, it could result in the preset pulling in manager-api
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code-wise this looks fine. I'll do a functional pass as well.
…hromaui/addon-visual-tests into jeppe/migrate-to-new-test-provider-api
🚀 PR was released in |
Depends on storybookjs/storybook#30943
This PR migrates to the new test provider API, and removes usage of the deprecated API.
That means:
title
anddescription
with a singlerender
function when registering the test provider in the manager. Therender
function is a simple combination of the existingTestingModuleDescription
component and theLegacyRender
component from Storybook core that was responsible for combiningtitle
anddescription
previously.SidebarTop
andSidebarBottom
components, that were fallback when used in older Storybook versions where the testing module didn't exist yet.TESTING_MODULE_X
events, but rather use thetestingProviderStore
when necessary.Also replaced
addon-essentials
withaddon-docs
, as it was now failing in the latest alphas.📦 Published PR as canary version:
4.0.0--canary.367.ede83ad.0
✨ Test out this PR locally via:
Version
Published prerelease version:
v4.0.0-next.4
Changelog
💥 Breaking Change
🚀 Enhancement
🐛 Bug Fix
next
Authors: 3