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

Release: Prerelease 8.4.0-beta.1 #29441

Merged
merged 42 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3c53875
Maintenance: Fix broken and outdated documentation links
jonniebigodes Oct 20, 2024
059df06
Fix linting issues
jonniebigodes Oct 21, 2024
6b3b114
Update code/lib/cli-storybook/src/automigrate/fixes/vite-config-file.ts
jonniebigodes Oct 22, 2024
ac25d4f
Update code/lib/cli-storybook/src/automigrate/fixes/vite-config-file.ts
jonniebigodes Oct 22, 2024
35c07cd
Update code/lib/cli-storybook/src/automigrate/fixes/remove-legacymdx1.ts
jonniebigodes Oct 22, 2024
955e3e8
Merge branch 'next' into code_remove_outdated_links_docs
jonniebigodes Oct 22, 2024
59bac4d
Merge branch 'next' into code_remove_outdated_links_docs
jonniebigodes Oct 22, 2024
2cde356
Revert "Revert "Addon Test: Error when addon interactions exists""
valentinpalkovic Oct 23, 2024
f742f57
Merge branch 'next' into revert-29433-revert-29338-yann/addon-interac…
valentinpalkovic Oct 24, 2024
f7c632d
Setup @storybook/experimental-addon-test just for authorized sandboxes
valentinpalkovic Oct 24, 2024
5008cb4
Merge branch 'next' into code_remove_outdated_links_docs
jonniebigodes Oct 24, 2024
5427981
Merge pull request #29412 from storybookjs/code_remove_outdated_links…
jonniebigodes Oct 24, 2024
5edc05e
Merge branch 'next-release' into next
storybook-bot Oct 24, 2024
41615d1
Merge branch 'next' into revert-29433-revert-29338-yann/addon-interac…
ghengeveld Oct 24, 2024
6be3da3
Rewordings
ghengeveld Oct 24, 2024
018cb2f
Remove unnecessary re-setting of field value, and apply linting fixes
ghengeveld Oct 24, 2024
3b870cc
Fix E2E tests
valentinpalkovic Oct 25, 2024
c02fe50
Show notifications in sidebar even if testing-module is not in place
valentinpalkovic Oct 25, 2024
84aef74
Escape XML when converting ANSI to HTML in test errors
ghengeveld Oct 25, 2024
6098c01
Merge pull request #29434 from storybookjs/revert-29433-revert-29338-…
valentinpalkovic Oct 25, 2024
228102d
ensure that spawning yarn works, by adding back all default env varia…
ndelangen Oct 25, 2024
efe13b2
Merge branch 'next' into escape-xml-in-error
valentinpalkovic Oct 25, 2024
02743b3
Upgrade VTA to v3.1.0
ghengeveld Oct 25, 2024
4eba200
Show checkmark icon in story status dropdown
ghengeveld Oct 25, 2024
8b08b4e
Update story status label for consistency
ghengeveld Oct 25, 2024
8e85d14
Merge branch 'next' into norbert/fix-yarn-detection
ndelangen Oct 25, 2024
dc2118e
Close story status menu when selecting an item
ghengeveld Oct 27, 2024
6d62c10
Open 'Component tests' addon panel when clicking a story status
ghengeveld Oct 27, 2024
ab45e76
Fix hidden stacktrace for assertion errors in test panel
ghengeveld Oct 27, 2024
1c1e50e
fix test
ndelangen Oct 28, 2024
db73a58
Merge branch 'norbert/fix-yarn-detection' of https://github.com/story…
ndelangen Oct 28, 2024
936293d
Merge pull request #29451 from storybookjs/story-status-menu-checkmark
valentinpalkovic Oct 28, 2024
05821e7
Merge branch 'next' into close-story-status-menu-on-select
valentinpalkovic Oct 28, 2024
fd3abe5
Merge branch 'next' into open-component-tests-panel-on-status-click
valentinpalkovic Oct 28, 2024
074d679
Merge pull request #29446 from storybookjs/escape-xml-in-error
valentinpalkovic Oct 28, 2024
e0f2877
Merge pull request #29458 from storybookjs/hide-assertion-error-stack…
valentinpalkovic Oct 28, 2024
5856975
Merge branch 'next' into upgrade-vta-3.1.0
ghengeveld Oct 28, 2024
0cf4576
Merge pull request #29456 from storybookjs/open-component-tests-panel…
valentinpalkovic Oct 28, 2024
5b7713f
Merge pull request #29455 from storybookjs/close-story-status-menu-on…
valentinpalkovic Oct 28, 2024
9fb3d98
Merge pull request #29448 from storybookjs/norbert/fix-yarn-detection
ndelangen Oct 28, 2024
48b4c4d
Merge pull request #29449 from storybookjs/upgrade-vta-3.1.0
valentinpalkovic Oct 28, 2024
c0236f8
Write changelog for 8.4.0-beta.1 [skip ci]
storybook-bot Oct 28, 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
12 changes: 12 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 8.4.0-beta.1

- Addon Test: Error when addon interactions exists - [#29434](https://github.com/storybookjs/storybook/pull/29434), thanks @valentinpalkovic!
- Addon Test: Escape XML when converting ANSI to HTML in test errors - [#29446](https://github.com/storybookjs/storybook/pull/29446), thanks @ghengeveld!
- Addon Test: Fix hiding stacktrace for assertion errors in test panel - [#29458](https://github.com/storybookjs/storybook/pull/29458), thanks @ghengeveld!
- CLI: Fix `yarn` detection - [#29448](https://github.com/storybookjs/storybook/pull/29448), thanks @ndelangen!
- Core: Close story status menu when selecting an item - [#29455](https://github.com/storybookjs/storybook/pull/29455), thanks @ghengeveld!
- Core: Open 'Component tests' addon panel when clicking a story status - [#29456](https://github.com/storybookjs/storybook/pull/29456), thanks @ghengeveld!
- Core: Show checkmark icon in story status dropdown and update status label for component tests - [#29451](https://github.com/storybookjs/storybook/pull/29451), thanks @ghengeveld!
- Dependencies: Upgrade VTA to v3.1.0 - [#29449](https://github.com/storybookjs/storybook/pull/29449), thanks @ghengeveld!
- Maintenance: Fix broken and outdated documentation links - [#29412](https://github.com/storybookjs/storybook/pull/29412), thanks @jonniebigodes!

## 8.4.0-beta.0

- Core: Add unified UI Testing Module - [#29241](https://github.com/storybookjs/storybook/pull/29241), thanks @yannbf!
Expand Down
1 change: 0 additions & 1 deletion code/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const config: StorybookConfig = {
addons: [
'@storybook/addon-themes',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-storysource',
'@storybook/addon-designs',
'@storybook/experimental-addon-test',
Expand Down
3 changes: 3 additions & 0 deletions code/addons/interactions/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ export const checkActionsLoaded = (configDir: string) => {
getConfig: (configFile) => serverRequire(configFile),
});
};

// This annotation is read by addon-test, so it can throw an error if both addons are used
export const ADDON_INTERACTIONS_IN_USE = true;
1 change: 1 addition & 0 deletions code/addons/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"react-dom": "^18.2.0",
"semver": "^7.6.3",
"slash": "^5.0.0",
"strip-ansi": "^7.1.0",
"ts-dedent": "^2.2.0",
"typescript": "^5.3.2",
"vitest": "^2.1.3"
Expand Down
8 changes: 7 additions & 1 deletion code/addons/test/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ const RelativeTime = ({ timestamp, testCount }: { timestamp: Date; testCount: nu
};

addons.register(ADDON_ID, (api) => {
const openAddonPanel = () => {
api.setSelectedPanel(PANEL_ID);
api.togglePanel(true);
};

addons.add(TEST_PROVIDER_ID, {
type: Addon_TypesEnum.experimental_TEST_PROVIDER,
runnable: true,
Expand Down Expand Up @@ -152,7 +157,7 @@ addons.register(ADDON_ID, (api) => {
.map(({ storyId, status, testRunId, ...rest }) => {
if (storyId) {
const statusObject: API_StatusObject = {
title: 'Vitest',
title: 'Component tests',
status: statusMap[status],
description:
'failureMessages' in rest && rest.failureMessages?.length
Expand All @@ -161,6 +166,7 @@ addons.register(ADDON_ID, (api) => {
data: {
testRunId,
},
onClick: openAddonPanel,
};
return [storyId, statusObject];
}
Expand Down
32 changes: 31 additions & 1 deletion code/addons/test/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TESTING_MODULE_WATCH_MODE_REQUEST,
} from 'storybook/internal/core-events';
import { oneWayHash, telemetry } from 'storybook/internal/telemetry';
import type { Options, StoryId } from 'storybook/internal/types';
import type { Options, PresetProperty, StoryId } from 'storybook/internal/types';

import picocolors from 'picocolors';
import { dedent } from 'ts-dedent';
Expand Down Expand Up @@ -99,3 +99,33 @@ export const experimental_serverChannel = async (channel: Channel, options: Opti

return channel;
};

export const previewAnnotations: PresetProperty<'previewAnnotations'> = async (
entry = [],
options
) => {
checkActionsLoaded(options.configDir);
return entry;
};

export const managerEntries: PresetProperty<'managerEntries'> = async (entry = [], options) => {
// Throw an error when addon-interactions is used.
// This is done by reading an annotation defined in addon-interactions, which although not ideal,
// is a way to handle addon conflict without having to worry about the order of which they are registered
const annotation = await options.presets.apply('ADDON_INTERACTIONS_IN_USE', false);
if (annotation) {
// eslint-disable-next-line local-rules/no-uncategorized-errors
const error = new Error(
dedent`
You have both "@storybook/addon-interactions" and "@storybook/experimental-addon-test" listed as addons in your Storybook config. This is not allowed, as @storybook/experimental-addon-test is a replacement for @storybook/addon-interactions.

Please remove "@storybook/addon-interactions" from the addons array in your main Storybook config at ${options.configDir} and remove the dependency from your package.json file.
`
);
error.name = 'AddonConflictError';
throw error;
}

// for whatever reason seems like the return type of managerEntries is not correct (it expects never instead of string[])
return entry as never;
};
4 changes: 3 additions & 1 deletion code/addons/test/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type StorybookTheme, useTheme } from 'storybook/internal/theming';

import Filter from 'ansi-to-html';
import stripAnsi from 'strip-ansi';

export function isTestAssertionError(error: unknown) {
return isChaiError(error) || isJestError(error);
Expand All @@ -22,12 +23,13 @@ export function isJestError(error: unknown) {
typeof error === 'object' &&
'message' in error &&
typeof error.message === 'string' &&
error.message.startsWith('expect(')
stripAnsi(error.message).startsWith('expect(')
);
}

export function createAnsiToHtmlFilter(theme: StorybookTheme) {
return new Filter({
escapeXML: true,
fg: theme.color.defaultText,
bg: theme.background.content,
});
Expand Down
2 changes: 1 addition & 1 deletion code/core/assets/server/base-preview-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h1 id="error-message"></h1>
<strong>Missing Context/Providers</strong>: You can use decorators to supply specific
contexts or providers, which are sometimes necessary for components to render correctly. For
detailed instructions on using decorators, please visit the
<a href="https://storybook.js.org/docs/react/writing-stories/decorators"
<a href="https://storybook.js.org/docs/writing-stories/decorators"
>Decorators documentation</a
>.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function hasNPM(cwd?: string) {
cwd,
shell: true,
env: {
...process.env,
COREPACK_ENABLE_STRICT: '0',
},
});
Expand All @@ -140,6 +141,7 @@ function hasPNPM(cwd?: string) {
cwd,
shell: true,
env: {
...process.env,
COREPACK_ENABLE_STRICT: '0',
},
});
Expand All @@ -151,6 +153,7 @@ function getYarnVersion(cwd?: string): 1 | 2 | undefined {
cwd,
shell: true,
env: {
...process.env,
COREPACK_ENABLE_STRICT: '0',
},
});
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/common/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const map =
resolved = resolveAddonName(configDir, name, options);
} catch (err) {
logger.error(
`Addon value should end in /manager or /preview or /register OR it should be a valid preset https://storybook.js.org/docs/react/addons/writing-presets/\n${item}`
`Addon value should end in /manager or /preview or /register OR it should be a valid preset https://storybook.js.org/docs/addons/writing-presets/\n${item}`
);
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ export const Story = {
const meta = {
title: 'Example/Header',
component: Header,
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
layout: 'fullscreen',
},
} satisfies Meta<typeof Header>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Your main configuration somehow does not contain a 'stories' field, or it resolv

Please check your main configuration file and make sure it exports a 'stories' field that is not an empty array.

More info: https://storybook.js.org/docs/react/faq#can-i-have-a-storybook-with-no-local-stories
More info: https://storybook.js.org/docs/faq#can-i-have-a-storybook-with-no-local-stories
]
`);
});
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/csf-tools/CsfFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class NoMetaError extends Error {
super(dedent`
CSF: ${message} ${formatLocation(ast, fileName)}

More info: https://storybook.js.org/docs/react/writing-stories#default-export
More info: https://storybook.js.org/docs/writing-stories#default-export
`);
this.name = this.constructor.name;
}
Expand Down
11 changes: 3 additions & 8 deletions code/core/src/manager/components/sidebar/RefIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ const ReadDocsMessage: FC = () => {
const theme = useTheme();

return (
<Message
href="https://storybook.js.org/docs/react/sharing/storybook-composition"
target="_blank"
>
<Message href="https://storybook.js.org/docs/sharing/storybook-composition" target="_blank">
<DocumentIcon color={theme.color.green} />
<div>
<MessageTitle>Read Composition docs</MessageTitle>
Expand Down Expand Up @@ -348,14 +345,12 @@ const LoadingMessage: FC<{ url: string }> = ({ url }) => {
);
};

// TODO: This is a temporary fix as the documentation link is not available with the 8.0 release, since the features it referenced were removed. See https://storybook.js.org/docs/7/sharing/storybook-composition#improve-your-storybook-composition for context.
const PerformanceDegradedMessage: FC = () => {
const theme = useTheme();

return (
<Message
href="https://storybook.js.org/docs/react/sharing/storybook-composition#improve-your-storybook-composition"
target="_blank"
>
<Message href="https://storybook.js.org/docs/sharing/storybook-composition" target="_blank">
<LightningIcon color={theme.color.gold} />
<div>
<MessageTitle>Reduce lag</MessageTitle>
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/manager/components/sidebar/SidebarBottom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const SidebarBottomBase = ({ api, notifications = [], status = {} }: Side
}, [api, testProviders, updateTestProvider, clearState]);

const testProvidersArray = Object.values(testProviders);
if (!hasWarnings && !hasErrors && !testProvidersArray.length) {
if (!hasWarnings && !hasErrors && !testProvidersArray.length && !notifications.length) {
return null;
}

Expand Down
7 changes: 5 additions & 2 deletions code/core/src/manager/components/sidebar/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CollapseIcon as CollapseIconSvg,
ExpandAltIcon,
StatusFailIcon,
StatusPassIcon,
StatusWarnIcon,
SyncIcon,
} from '@storybook/icons';
Expand Down Expand Up @@ -210,9 +211,10 @@ const Node = React.memo<NodeProps>(function Node({
{icon ? (
<WithTooltip
closeOnOutsideClick
closeOnTriggerHidden
onClick={(event) => event.stopPropagation()}
placement="bottom"
tooltip={() => (
tooltip={({ onHide }) => (
<TooltipLinkList
links={Object.entries(status || {})
.sort(
Expand All @@ -224,7 +226,7 @@ const Node = React.memo<NodeProps>(function Node({
description: value.description,
'aria-label': `Test status for ${value.title}: ${value.status}`,
icon: {
success: null, // We don't show a checkmark, to avoid clutter
success: <StatusPassIcon color={theme.color.positive} />,
error: <StatusFailIcon color={theme.color.negative} />,
warn: <StatusWarnIcon color={theme.color.warning} />,
pending: <SyncIcon size={12} color={theme.color.defaultText} />,
Expand All @@ -233,6 +235,7 @@ const Node = React.memo<NodeProps>(function Node({
onClick: () => {
onSelectStoryId(item.id);
value.onClick?.();
onHide();
},
}))}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const parseArgsParam = (argsString: string): Args => {
once.warn(dedent`
Omitted potentially unsafe URL args.

More info: https://storybook.js.org/docs/react/writing-stories/args#setting-args-through-the-url
More info: https://storybook.js.org/docs/writing-stories/args#setting-args-through-the-url
`);
return acc;
}, {} as Args);
Expand Down
4 changes: 2 additions & 2 deletions code/core/src/preview-api/modules/store/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const validateOptions = (args: Args, argTypes: ArgTypes): Args => {
once.error(dedent`
Invalid argType: '${key}.options' should be an array.

More info: https://storybook.js.org/docs/react/api/argtypes
More info: https://storybook.js.org/docs/api/arg-types
`);
return allowArg();
}
Expand All @@ -129,7 +129,7 @@ export const validateOptions = (args: Args, argTypes: ArgTypes): Args => {
once.error(dedent`
Invalid argType: '${key}.options' should only contain primitives. Use a 'mapping' for complex values.

More info: https://storybook.js.org/docs/react/writing-stories/args#mapping-to-complex-arg-values
More info: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
`);
return allowArg();
}
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/router/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export const buildArgsParam = (initialArgs: Args | undefined, args: Args): strin
once.warn(dedent`
Omitted potentially unsafe URL args.

More info: https://storybook.js.org/docs/react/writing-stories/args#setting-args-through-the-url
More info: https://storybook.js.org/docs/writing-stories/args#setting-args-through-the-url
`);
return acc;
}, {} as Args);
Expand Down
8 changes: 4 additions & 4 deletions code/core/src/server-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class ConflictingStaticDirConfigError extends StorybookError {
category: Category.CORE_SERVER,
code: 1,
documentation:
'https://storybook.js.org/docs/react/configure/images-and-assets#serving-static-files-via-storybook-configuration',
'https://storybook.js.org/docs/configure/integration/images-and-assets#serving-static-files-via-storybook-configuration',
message: dedent`
Storybook encountered a conflict when trying to serve statics. You have configured both:
* Storybook's option in the config file: 'staticDirs'
Expand All @@ -133,7 +133,7 @@ export class InvalidStoriesEntryError extends StorybookError {
category: Category.CORE_COMMON,
code: 4,
documentation:
'https://storybook.js.org/docs/react/faq#can-i-have-a-storybook-with-no-local-stories',
'https://storybook.js.org/docs/faq#can-i-have-a-storybook-with-no-local-stories',
message: dedent`
Storybook could not index your stories.
Your main configuration somehow does not contain a 'stories' field, or it resolved to an empty array.
Expand All @@ -150,7 +150,7 @@ export class WebpackMissingStatsError extends StorybookError {
code: 1,
documentation: [
'https://webpack.js.org/configuration/stats/',
'https://storybook.js.org/docs/react/builders/webpack#configure',
'https://storybook.js.org/docs/builders/webpack#configure',
],
message: dedent`
No Webpack stats found. Did you turn off stats reporting in your Webpack config?
Expand Down Expand Up @@ -217,7 +217,7 @@ export class MissingAngularJsonError extends StorybookError {
super({
category: Category.CLI_INIT,
code: 2,
documentation: 'https://storybook.js.org/docs/angular/faq#error-no-angularjson-file-found',
documentation: 'https://storybook.js.org/docs/faq#error-no-angularjson-file-found',
message: dedent`
An angular.json file was not found in the current working directory: ${data.path}
Storybook needs it to work properly, so please rerun the command at the root of your project, where the angular.json file is located.`,
Expand Down
Loading
Loading