Created
April 29, 2018 06:19
-
-
Save regalius/0e053f035f2cd932c803f1f80d22821e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import initStoryshots, { | |
| multiSnapshotWithOptions, | |
| imageSnapshot | |
| } from "@storybook/addon-storyshots"; | |
| import path from "path"; | |
| initStoryshots({ | |
| suite: "Storyshots", | |
| integrityOptions: { cwd: __dirname }, | |
| test: multiSnapshotWithOptions({}) | |
| }); | |
| const getMatchOptions = ({ context: { fileName } }) => { | |
| const customSnapshotsDir = `${fileName.slice( | |
| 0, | |
| fileName.lastIndexOf("/") | |
| )}/_image_snapshots_`; | |
| return { | |
| customSnapshotsDir | |
| }; | |
| }; | |
| let storybookUrl = "http://localhost:9009"; | |
| if (process.env.CI) { // 👈 if in CI environment point to static build | |
| storybookUrl = `file://${path.join(__dirname, "../storybook-static")}`; | |
| } | |
| initStoryshots({ | |
| suite: "Image Storyshots", | |
| test: imageSnapshot({ | |
| storybookUrl, | |
| getMatchOptions | |
| }) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment