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

Docs: Misc 8.1 updates #27132

Merged
merged 4 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 3 deletions code/addons/docs/docs/docspage.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ You can override this default behavior in `.storybook/preview.js` (or in any of
export const parameters = {
docs: {
canvas: {
sourceState: 'shown'
}
}
sourceState: 'shown',
},
},
};
```

Expand Down
4 changes: 3 additions & 1 deletion docs/api/portable-stories-playwright.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Portable stories in Playwright'
title: 'Portable stories in Playwright CT'
---

export const SUPPORTED_RENDERERS = ['react', 'vue'];
Expand Down Expand Up @@ -34,6 +34,8 @@ Normally, Storybook composes a story and its [annotations](#annotations) automat

<Callout variant="warning">

Your project must be using React 18+ to use the portable stories API with Playwright CT.

**Using `Next.js`?** The portable stories API is not yet supported in Next.js with Playwright CT.

<!-- **Using `Next.js`?** Next.js requires specific configuration that is only available in [Jest](./portable-stories-jest.md). The portable stories API is not supported in Next.js with Playwright CT. -->
Expand Down
Binary file modified docs/api/story-pipeline-playwright-ct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/api/story-pipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/writing-stories/mocking-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ import { getUserFromSession } from '#lib/session';
// ... rest of the file
```

<Callout variant="info">

Subpath imports will only be correctly resolved and typed when the [`moduleResolution` property](https://www.typescriptlang.org/tsconfig/#moduleResolution) is set to `'Bundler'`, `'NodeNext'`, or `'Node16'` in your TypeScript configuration.

If you are currently using `'node'`, that is intended for projects using a Node.js version older than v10. Projects written with modern code likely do not need to use `'node'`.

Storybook recommends the [TSConfig Cheat Sheet](https://www.totaltypescript.com/tsconfig-cheat-sheet) for guidance on setting up your TypeScript configuration.

</Callout>

## Builder aliases

If your project is unable to use [subpath imports](#subpath-imports), you can configure your Storybook builder to alias the module to the mock file. This will instruct the builder to replace the module with the mock file when bundling your Storybook stories.
Expand Down