Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
47f55fb
fix: fixed broken migration guide link
selenehyun Jul 30, 2025
29048f6
Docs: Further improvements
kylegach Jul 31, 2025
e4cd834
More details about project roots
kylegach Jul 31, 2025
8483d0b
Fixes
kylegach Jul 31, 2025
c8088d9
Merge branch 'next' into docs-automocking-2
kylegach Jul 31, 2025
f6868f0
Spell out `process.cwd` as root
kylegach Jul 31, 2025
58db607
Docs: Add `afterEach` guidance
kylegach Jul 30, 2025
f08fe97
Address feedback
kylegach Jul 31, 2025
f148fae
Move troubleshooting to bottom
kylegach Aug 1, 2025
84ea113
Merge pull request #32166 from storybookjs/docs-automocking-2
kylegach Aug 1, 2025
32fbe3a
Merge branch 'next-release' into next
storybook-bot Aug 1, 2025
53046fe
Onboarding: Tweak referral wording in survey
shilman Aug 4, 2025
74aa094
Merge pull request #32185 from storybookjs/shilman/tweak-survey
yannbf Aug 4, 2025
d92b88a
Update CHANGELOG.md for v9.1.1 [skip ci]
storybook-bot Aug 4, 2025
404c4f3
Merge branch 'next' into update-migration-link
jonniebigodes Aug 5, 2025
7ad8911
Docs: Fix broken link in migration guide
kylegach Aug 5, 2025
8a3bc56
Merge branch 'next' into docs-after-each
kylegach Aug 5, 2025
94ef419
Merge pull request #32148 from selenehyun/update-migration-link
jonniebigodes Aug 5, 2025
479765e
CLI: FIx Docs migration link
jonniebigodes Aug 5, 2025
b6edefe
Merge pull request #32156 from storybookjs/docs-after-each
kylegach Aug 5, 2025
022ad9e
Merge branch 'next' into docs-bad-upgrading-link
jonniebigodes Aug 5, 2025
8c8bdc5
Merge pull request #32198 from storybookjs/docs-bad-upgrading-link
kylegach Aug 5, 2025
ead67db
Merge pull request #32196 from storybookjs/cli_fix_migration_link
yannbf Aug 6, 2025
738ca0c
Write changelog for 9.2.0-alpha.2 [skip ci]
storybook-bot Aug 6, 2025
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 9.1.1

- CLI: Fix throwing in readonly environments - [#31785](https://github.com/storybookjs/storybook/pull/31785), thanks @JReinhold!
- Onboarding: Tweak referral wording in survey - [#32185](https://github.com/storybookjs/storybook/pull/32185), thanks @shilman!
- Telemetry: Send index stats on dev exit - [#32168](https://github.com/storybookjs/storybook/pull/32168), thanks @shilman!

## 9.1.0

Storybook 9.1 is packed with new features and improvements to enhance accessibility, streamline testing, and make your development workflow even smoother!
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 9.2.0-alpha.2

- Onboarding: Tweak referral wording in survey - [#32185](https://github.com/storybookjs/storybook/pull/32185), thanks @shilman!

## 9.2.0-alpha.1

- Addon Docs: Add `__STORYBOOK_UNSAFE_TOCBOT__` global - [#32176](https://github.com/storybookjs/storybook/pull/32176), thanks @yannbf!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const IntentSurvey = ({
},
},
referrer: {
label: 'How did you learn about Storybook?',
label: 'How did you discover Storybook?',
type: 'select',
required: true,
options: shuffleObject({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('logMigrationSummary', () => {

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/migration-guide
Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/releases/migration-guide
And reach out on Discord if you need help: https://discord.gg/storybook"
`);
});
Expand All @@ -132,7 +132,7 @@ describe('logMigrationSummary', () => {

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/migration-guide
Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/releases/migration-guide
And reach out on Discord if you need help: https://discord.gg/storybook"
`);
});
Expand All @@ -153,7 +153,7 @@ describe('logMigrationSummary', () => {

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/migration-guide
Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/docs/releases/migration-guide
And reach out on Discord if you need help: https://discord.gg/storybook"
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function logMigrationSummary({
The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Please check the changelog and migration guide for manual migrations and more information: ${picocolors.yellow(
'https://storybook.js.org/docs/migration-guide'
'https://storybook.js.org/docs/releases/migration-guide'
)}
And reach out on Discord if you need help: ${picocolors.yellow('https://discord.gg/storybook')}
`);
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli-storybook/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function logUpgradeResults(
}

logger.log(
`For a full list of changes, please check our migration guide: ${CLI_COLORS.cta('https://storybook.js.org/docs/migration-guide')}`
`For a full list of changes, please check our migration guide: ${CLI_COLORS.cta('https://storybook.js.org/docs/releases/migration-guide')}`
);
}

Expand Down
3 changes: 2 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,6 @@
"Dependency Upgrades"
]
]
}
},
"deferredNextVersion": "9.2.0-alpha.2"
}
185 changes: 185 additions & 0 deletions docs/_snippets/after-each-in-meta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
```ts filename="Page.stories.ts" renderer="angular" language="ts"
import type { Meta, StoryObj } from '@storybook/angular';

import { Page } from './Page';

const meta: Meta<Page> = {
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
};
export default meta;

type Story = StoryObj<Page>;

export const Default: Story = {
async play({ canvas }) {
// ...
},
};
```

```svelte filename="Page.stories.svelte" renderer="svelte" language="js" tabTitle="Svelte CSF"
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';

import Page from './Page.svelte';

const meta = defineMeta({
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
});
</script>

<Story name="Default" play={async ({ canvas }) => {
// ...
}}
/>
```

```js filename="Page.stories.js" renderer="svelte" language="js" tabTitle="CSF"
import Page from './Page.svelte';

export default {
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
};

export const Default = {
async play({ canvas }) {
// ...
},
};
```

```js filename="Page.stories.js" renderer="common" language="js"
import { Page } from './Page';

export default {
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
};

export const Default = {
async play({ canvas }) {
// ...
},
};
```

```svelte filename="Page.stories.svelte" renderer="svelte" language="ts" tabTitle="Svelte CSF"
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';

import Page from './Page.svelte';

const meta = defineMeta({
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
});
</script>

<Story name="Default" play={async ({ canvas }) => {
// ...
}}
/>
```

```ts filename="Page.stories.ts" renderer="svelte" language="ts" tabTitle="CSF"
// Replace your-framework with svelte-vite or sveltekit
import type { Meta, StoryObj } from '@storybook/your-framework';

import Page from './Page.svelte';

const meta = {
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
} satisfies Meta<typeof Page>;
export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
async play({ canvas }) {
// ...
},
};
```

```ts filename="Page.stories.ts" renderer="common" language="ts"
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Meta, StoryObj } from '@storybook/your-framework';

import { Page } from './Page';

const meta = {
component: Page,
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
} satisfies Meta<typeof Page>;
export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
async play({ canvas }) {
// ...
},
};
```

```js filename="Page.stories.js" renderer="web-components" language="js"
export default {
component: 'my-page',
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
};

export const Default = {
async play({ canvas }) {
// ...
},
};
```

```ts filename="Page.stories.ts" renderer="web-components" language="ts"
import type { Meta, StoryObj } from '@storybook/web-components-vite';

const meta: Meta = {
component: 'my-page',
// 👇 Runs after each story in this file
async afterEach(context) {
console.log(`✅ Tested ${context.name} story`);
},
};
export default meta;

type Story = StoryObj;

export const Default: Story = {
async play({ canvas }) {
// ...
},
};
```
21 changes: 21 additions & 0 deletions docs/_snippets/automock-register-full.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```ts filename=".storybook/preview.ts" renderer="common" language="ts"
import { sb } from 'storybook/test';

// 👇 Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock(import('../lib/session.ts'));
// 👇 Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock(import('uuid'));

// ...rest of the file
```

```js filename=".storybook/preview.js" renderer="common" language="js"
import { sb } from 'storybook/test';

// 👇 Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock('../lib/session.js');
// 👇 Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock('uuid');

// ...rest of the file
```
21 changes: 21 additions & 0 deletions docs/_snippets/automock-register-mock-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```ts filename=".storybook/preview.ts" renderer="common" language="ts"
import { sb } from 'storybook/test';

// 👇 Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock(import('../lib/session.ts'));
// 👇 Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock(import('uuid'));
Comment on lines +5 to +7
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Inconsistent file extensions in comments - session.ts mock but uuid.ts for JavaScript package. Consider using .js for consistency in JS examples or clarify the extension handling.


// ...rest of the file
```

```js filename=".storybook/preview.js" renderer="common" language="js"
import { sb } from 'storybook/test';

// 👇 Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock('../lib/session.js');
// 👇 Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock('uuid');
Comment on lines +16 to +18
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: File extension mismatch: comment references session.ts and uuid.ts but the actual mock calls use .js extension. The comments should match the implementation.


// ...rest of the file
```
21 changes: 21 additions & 0 deletions docs/_snippets/automock-register-spy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```ts filename=".storybook/preview.ts" renderer="common" language="ts"
import { sb } from 'storybook/test';

// 👇 Automatically spies on all exports from the `lib/session` local module
sb.mock(import('../lib/session.ts'), { spy: true });
// 👇 Automatically spies on all exports from the `uuid` package in `node_modules`
sb.mock(import('uuid'), { spy: true });
Comment on lines +5 to +7
Copy link
Contributor

Choose a reason for hiding this comment

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

style: TypeScript version uses import() wrapper while JavaScript version uses string paths - this inconsistency might confuse users about when to use each approach


// ...rest of the file
```

```js filename=".storybook/preview.js" renderer="common" language="js"
import { sb } from 'storybook/test';

// 👇 Automatically spies on all exports from the `lib/session` local module
sb.mock('../lib/session.js', { spy: true });
// 👇 Automatically spies on all exports from the `uuid` package in `node_modules`
sb.mock('uuid', { spy: true });

// ...rest of the file
```
Loading
Loading