Skip to content

Commit e7b654d

Browse files
authored
Merge branch 'next' into yann/rename-local-tests
2 parents 1e17cca + fd5928f commit e7b654d

26 files changed

+571
-700
lines changed

MIGRATION.md

Lines changed: 525 additions & 238 deletions
Large diffs are not rendered by default.

code/addons/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"react-dom": "^18.2.0",
146146
"rehype-external-links": "^3.0.0",
147147
"rehype-slug": "^6.0.0",
148-
"telejson": "8.0.0--canary.106.377d63b.0",
148+
"telejson": "8.0.0",
149149
"tocbot": "^4.20.1",
150150
"typescript": "^5.7.3",
151151
"vite": "^6.2.5"

code/addons/vitest/src/components/TestProviderRender.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { addons } from 'storybook/manager-api';
1616
import type { API } from 'storybook/manager-api';
1717
import { styled } from 'storybook/theming';
1818

19-
import { A11Y_ADDON_ID, A11Y_PANEL_ID, PANEL_ID } from '../constants';
19+
import { A11Y_ADDON_ID, A11Y_PANEL_ID, COMPONENT_TESTING_PANEL_ID } from '../constants';
2020
import type { StoreState } from '../types';
2121
import type { StatusValueToStoryIds } from '../use-test-provider-state';
2222
import { Description } from './Description';
@@ -282,7 +282,7 @@ export const TestProviderRender: FC<TestProviderRenderProps> = ({
282282
onClick={() => {
283283
openPanel({
284284
api,
285-
panelId: PANEL_ID,
285+
panelId: COMPONENT_TESTING_PANEL_ID,
286286
entryId:
287287
componentTestStatusValueToStoryIds['status-value:error'][0] ??
288288
componentTestStatusValueToStoryIds['status-value:warning'][0] ??

code/addons/vitest/src/constants.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import type { StoreOptions } from 'storybook/internal/types';
22

33
import type { StoreState } from './types';
44

5+
export { PANEL_ID as COMPONENT_TESTING_PANEL_ID } from '../../../core/src/component-testing/constants';
6+
export {
7+
PANEL_ID as A11Y_PANEL_ID,
8+
ADDON_ID as A11Y_ADDON_ID,
9+
} from '../../../addons/a11y/src/constants';
10+
511
export const ADDON_ID = 'storybook/test';
612
export const TEST_PROVIDER_ID = `${ADDON_ID}/test-provider`;
7-
export const PANEL_ID = `${ADDON_ID}/panel`;
813
export const STORYBOOK_ADDON_TEST_CHANNEL = 'STORYBOOK_ADDON_TEST_CHANNEL';
914

10-
export const A11Y_ADDON_ID = 'storybook/a11y';
11-
export const A11Y_PANEL_ID = `${A11Y_ADDON_ID}/panel`;
12-
1315
export const TUTORIAL_VIDEO_LINK = 'https://youtu.be/Waht9qq7AoA';
1416
export const DOCUMENTATION_LINK = 'writing-tests/test-addon';
1517
export const DOCUMENTATION_FATAL_ERROR_LINK = `${DOCUMENTATION_LINK}#what-happens-if-vitest-itself-has-an-error`;
@@ -19,11 +21,14 @@ export const COVERAGE_DIRECTORY = 'coverage';
1921
export const SUPPORTED_FRAMEWORKS = [
2022
'@storybook/nextjs',
2123
'@storybook/nextjs-vite',
24+
'@storybook/react-vite',
25+
'@storybook/svelte-vite',
26+
'@storybook/vue3-vite',
27+
'@storybook/html-vite',
28+
'@storybook/web-components-vite',
2229
'@storybook/sveltekit',
2330
];
2431

25-
export const SUPPORTED_RENDERERS = ['@storybook/react', '@storybook/svelte', '@storybook/vue3'];
26-
2732
export const storeOptions = {
2833
id: ADDON_ID,
2934
initialState: {

code/addons/vitest/src/manager.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from 'react';
22

3-
import { type Addon_TestProviderType, Addon_TypesEnum } from 'storybook/internal/types';
3+
import { Addon_TypesEnum } from 'storybook/internal/types';
44

55
import {
66
a11yStatusStore,
@@ -13,7 +13,7 @@ import { addons } from 'storybook/manager-api';
1313
import { GlobalErrorContext, GlobalErrorModal } from './components/GlobalErrorModal';
1414
import { SidebarContextMenu } from './components/SidebarContextMenu';
1515
import { TestProviderRender } from './components/TestProviderRender';
16-
import { A11Y_PANEL_ID, ADDON_ID, PANEL_ID, TEST_PROVIDER_ID } from './constants';
16+
import { A11Y_PANEL_ID, ADDON_ID, COMPONENT_TESTING_PANEL_ID, TEST_PROVIDER_ID } from './constants';
1717
import { useTestProvider } from './use-test-provider-state';
1818

1919
addons.register(ADDON_ID, (api) => {
@@ -24,7 +24,7 @@ addons.register(ADDON_ID, (api) => {
2424
api.togglePanel(true);
2525
};
2626
componentTestStatusStore.onSelect(() => {
27-
openPanel(PANEL_ID);
27+
openPanel(COMPONENT_TESTING_PANEL_ID);
2828
});
2929
a11yStatusStore.onSelect(() => {
3030
openPanel(A11Y_PANEL_ID);

code/addons/vitest/src/postinstall.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { coerce, satisfies } from 'semver';
2626
import { dedent } from 'ts-dedent';
2727

2828
import { type PostinstallOptions } from '../../../lib/cli-storybook/src/add';
29-
import { SUPPORTED_FRAMEWORKS, SUPPORTED_RENDERERS } from './constants';
29+
import { SUPPORTED_FRAMEWORKS } from './constants';
3030
import { printError, printInfo, printSuccess, printWarning, step } from './postinstall-logger';
3131
import { loadTemplate, updateConfigFile, updateWorkspaceFile } from './updateVitestFile';
3232
import { getAddonNames } from './utils';
@@ -112,9 +112,7 @@ export default async function postInstall(options: PostinstallOptions) {
112112
? info.frameworkPackageName === '@storybook/nextjs'
113113
? '@storybook/nextjs-vite'
114114
: info.frameworkPackageName
115-
: info.rendererPackageName && SUPPORTED_RENDERERS.includes(info.rendererPackageName)
116-
? info.rendererPackageName
117-
: null;
115+
: null;
118116

119117
const isRendererSupported = !!annotationsImport;
120118

code/addons/vitest/src/vitest-plugin/setup-file.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('modifyErrorMessage', () => {
2727

2828
expect(task.result?.errors?.[0].message).toMatchInlineSnapshot(`
2929
"
30-
[34mClick to debug the error directly in Storybook: http://localhost:6006/?path=/story/my-story&addonPanel=storybook/test/panel[39m
30+
[34mClick to debug the error directly in Storybook: http://localhost:6006/?path=/story/my-story&addonPanel=storybook/interactions/panel[39m
3131
3232
Original error message"
3333
`);

code/addons/vitest/src/vitest-plugin/setup-file.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import type { RunnerTask } from 'vitest';
66

77
import { Channel } from 'storybook/internal/channels';
88

9+
import { COMPONENT_TESTING_PANEL_ID } from '../constants';
10+
911
declare global {
1012
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1113
// @ts-ignore - The module is augmented elsewhere but we need to duplicate it to avoid issues in no-link mode.
@@ -30,7 +32,7 @@ export const modifyErrorMessage = ({ task }: { task: Task }) => {
3032
) {
3133
const currentError = task.result.errors[0];
3234
const storybookUrl = import.meta.env.__STORYBOOK_URL__;
33-
const storyUrl = `${storybookUrl}/?path=/story/${meta.storyId}&addonPanel=storybook/test/panel`;
35+
const storyUrl = `${storybookUrl}/?path=/story/${meta.storyId}&addonPanel=${COMPONENT_TESTING_PANEL_ID}`;
3436
currentError.message = `\n\x1B[34mClick to debug the error directly in Storybook: ${storyUrl}\x1B[39m\n\n${currentError.message}`;
3537
}
3638
};

code/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@
768768
"store2": "^2.14.2",
769769
"strip-ansi": "^7.1.0",
770770
"strip-json-comments": "^5.0.1",
771-
"telejson": "8.0.0--canary.106.377d63b.0",
771+
"telejson": "8.0.0",
772772
"tiny-invariant": "^1.3.1",
773773
"tinyspy": "^3.0.2",
774774
"ts-dedent": "^2.0.0",

code/frameworks/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"fd-package-json": "^1.2.0",
6363
"find-up": "^5.0.0",
6464
"semver": "^7.3.7",
65-
"telejson": "8.0.0--canary.106.377d63b.0",
65+
"telejson": "8.0.0",
6666
"ts-dedent": "^2.0.0",
6767
"tsconfig-paths-webpack-plugin": "^4.0.1",
6868
"util-deprecate": "^1.0.2",

0 commit comments

Comments
 (0)