Skip to content

Commit

Permalink
Update MIGRATION.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman authored Nov 10, 2023
1 parent f2372d1 commit 6fbaa99
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
# `@storybook/addon-storyshots` Migration Guide

`@storybook/addon-storyshots` was replaced by the [Storybook test-runner](https://storybook.js.org/docs/react/writing-tests/test-runner) in 2021, due to storyshots being a performance and maintenance problem for Storybook. As Storybook 8 moves forward with the `storyStoreV7` and its on-demand architecture, `@storybook/addon-storyshots` will become incompatible, and you'll have to migrate from it. This migration guide will aid you in that process.
Storyshots (`@storybook/addon-storyshots`) was Storybook's original testing solution. It providing automatic snapshot testing and rich configurability. However, it was fundamentally incompatible with Storybook 7's high-performance [on-demand architecture](https://storybook.js.org/blog/storybook-on-demand-architecture/), and suffered from other limitations. In response, we created [Storybook test-runner](https://storybook.js.org/docs/react/writing-tests/test-runner) as a successor in 2021.

Below you will find two options to migrate. We recommend migrating to and using the Storybook test-runner, but you can decide for yourself which path to choose, by following the guides below.
Now that we are finally removing the old architecture in Storybook 8, Storyshots will become incompatible. If you're using Storyshots and you want to upgrade to Storybook 8, you'll need to migrate to something else. This guide will aid you in that process.

## Option 1 - Portable stories
Below you will find serveral options to migrate:
1. **Storybook test-runner** is Storybook's recommended open source testing tool.
1. **Portable stories** is an alternative approach that might be an easier migration from Storyshots, and is also supported by the core team.
3. **Chromatic** is a great option if you are looking for a fully hosted service, and built by Storybook maintainers.

You can decide for yourself which path to choose, by following the guides below.

## Option 1 - Storybook test-runner

Storybook test-runner turns all of your stories into executable tests, powered by [Jest](https://jestjs.io/) and [Playwright](https://playwright.dev/). It's powerful and provides multi-browser testing, and you can achieve many things with it such as smoke testing, DOM snapshot testing, Accessibility testing, Visual Regression testing and more.

The test-runner supports any official Storybook framework, and is compatible with community frameworks (support may vary). If you use Storybook for React Native, you can use the test-runner as long as you set up the [react-native-web addon](https://storybook.js.org/addons/%2540storybook/addon-react-native-web) in your project.

Follow the [migration steps to test-runner here](./MIGRATION.test-runner.md).

## Option 2 - Portable stories

Portable stories are utilities from Storybook that assist in converting stories from a story file into renderable elements that can be reused in your Node tests with JSDOM with tools like [Jest](https://jestjs.io/) or [Vitest](https://vitest.dev/). This is the closest you will get from storyshots, but with the caveat that you will face similar challenges, given that the tests still run in Node.

If your project uses React, React Native (without the [react-native-web addon](https://storybook.js.org/addons/%2540storybook/addon-react-native-web)) or Vue3, and you use storyshots extensively with complex mocking mechanisms and snapshot serializers, this migration will be the most seamless to you.

Follow the [migration steps to portable stories here](./MIGRATION.portable-stories.md).

## Option 2 - Storybook test-runner

The Storybook test-runner turns all of your stories into executable tests, powered by [Jest](https://jestjs.io/) and [Playwright](https://playwright.dev/). It's powerful and provides multi-browser testing, and you can achieve many things with it such as smoke testing, DOM snapshot testing, Accessibility testing, Visual Regression testing and more.
## Option 3 - Chromatic

The test-runner supports any official Storybook framework, and is compatible with community frameworks (support may vary). If you use Storybook for React Native, you can use the test-runner as long as you set up the [react-native-web addon](https://storybook.js.org/addons/%2540storybook/addon-react-native-web) in your project.

Follow the [migration steps to test-runner here](./MIGRATION.test-runner.md).
[Chromatic](https://www.chromatic.com/) is a cloud service for taking visual snapshots of your stories, developed by the maintainers of Storybook. It is easy to set up and configure, and has a free plan. We recommend it if you are looking for a high quality hosted testing solution. See the [Chromatic site](https://www.chromatic.com/) for setup instructions.

0 comments on commit 6fbaa99

Please sign in to comment.