Skip to content

Instantly share code, notes, and snippets.

@fczuardi
Created October 16, 2017 16:58
Show Gist options
  • Save fczuardi/e5747e97211f03a82331a89a262affb8 to your computer and use it in GitHub Desktop.
Save fczuardi/e5747e97211f03a82331a89a262affb8 to your computer and use it in GitHub Desktop.
{
"presets": [
"env",
"react"
]
}
import { configure } from '@storybook/react';
const req = require.context("../", true, /\.story\.js$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}
configure(loadStories, module);
import * as React from "react";
const Foo = (props) => (
<p>foo</p>
);
export default Foo;
import React from 'react';
import { storiesOf } from '@storybook/react';
import Foo from ".";
storiesOf('Foo', module).add('to Storybook', () => <Foo></Foo>);
yarn global add @storybook/cli
mkdir jest-issue
cd jest-issue/
yarn init -y
yarn add -D lerna
node --version
# v8.5.0
yarn --version
# 1.2.1
yarn info lerna version
# 2.4.0
npx lerna init --use-workspaces --independent
yarn add -D react react-dom
yarn add -D @storybook/react @storybook/addon-storyshots
yarn add -D jest react-test-renderer
yarn add -D babel babel-preset-react babel-preset-env
vim .babelrc
vim Storyshots.test.js
cd packages/
mkdir foo
cd foo
mkdir src
vim src/index.js
vim src/index.story.js
cd ../../
# npx start-storybook -p 6006
npx jest
import initStoryshots from "@storybook/addon-storyshots";
initStoryshots();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment