diff --git a/.bettercodehub.yml b/.bettercodehub.yml new file mode 100644 index 000000000000..0e0befbfead7 --- /dev/null +++ b/.bettercodehub.yml @@ -0,0 +1,14 @@ +component_depth: 2 +languages: +- javascript + +- name: javascript + production: + exclude: + - .*\.test\.js + - .*\/__test__\/.*\.js + - .*\/__mock__\/.*\.js + test: + include: + - .*\.test\.js + - .*\/__test__\/.*\.js diff --git a/.gitignore b/.gitignore index 1b6241f1f98f..7fc1c2d6b365 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ npm-shrinkwrap.json dist .tern-port *.DS_Store +.jest +junit.xml +coverage/ *.lerna_backup build packages/examples/automated-* diff --git a/.jestrc b/.jestrc new file mode 100644 index 000000000000..54d287ef5dd4 --- /dev/null +++ b/.jestrc @@ -0,0 +1,20 @@ +{ + "cacheDirectory": ".jest", + "clearMocks": true, + "moduleNameMapper": { + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", + "\\.(css|scss)$": "/__mocks__/styleMock.js" + }, + "roots": ["packages"], + "collectCoverage": false, + "collectCoverageFrom": [ + "packages/**/*.{js,jsx}", + "!**/generators/**" + ], + "coverageDirectory": "coverage", + "testEnvironment": "jsdom", + "setupTestFrameworkScriptFile": "./node_modules/jest-enzyme/lib/index.js", + "snapshotSerializers": [ + "enzyme-to-json/serializer" + ] +} diff --git a/.travis.yml b/.travis.yml index e906c10cbae3..0b221d04b26d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,18 @@ language: node_js cache: - yarn: true directories: - node_modules + - .jest notifications: email: false node_js: - "node" before_install: ./scripts/travis/before_install.sh after_success: ./scripts/travis/after_success.sh -script: npm run lint && npm run test +script: + - npm run lint + - npm run test + - npm run coverage + - npm run test-examples git: depth: 1 diff --git a/__mocks__/fileMock.js b/__mocks__/fileMock.js new file mode 100644 index 000000000000..105ff49748fa --- /dev/null +++ b/__mocks__/fileMock.js @@ -0,0 +1 @@ +module.exports = 'file-stub'; diff --git a/__mocks__/styleMock.js b/__mocks__/styleMock.js new file mode 100644 index 000000000000..f053ebf7976e --- /dev/null +++ b/__mocks__/styleMock.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/packages/getstorybookio/.storybook/addons.js b/docs/.storybook/addons.js similarity index 100% rename from packages/getstorybookio/.storybook/addons.js rename to docs/.storybook/addons.js diff --git a/packages/getstorybookio/.storybook/config.js b/docs/.storybook/config.js similarity index 100% rename from packages/getstorybookio/.storybook/config.js rename to docs/.storybook/config.js diff --git a/packages/getstorybookio/.storybook/notes_addon.js b/docs/.storybook/notes_addon.js similarity index 100% rename from packages/getstorybookio/.storybook/notes_addon.js rename to docs/.storybook/notes_addon.js diff --git a/packages/getstorybookio/README.md b/docs/README.md similarity index 100% rename from packages/getstorybookio/README.md rename to docs/README.md diff --git a/packages/getstorybookio/app.json b/docs/app.json similarity index 100% rename from packages/getstorybookio/app.json rename to docs/app.json diff --git a/packages/getstorybookio/favicon.ico b/docs/favicon.ico similarity index 100% rename from packages/getstorybookio/favicon.ico rename to docs/favicon.ico diff --git a/packages/getstorybookio/index.html b/docs/index.html similarity index 100% rename from packages/getstorybookio/index.html rename to docs/index.html diff --git a/packages/getstorybookio/package.json b/docs/package.json similarity index 86% rename from packages/getstorybookio/package.json rename to docs/package.json index 41810591220b..6bfbeae02689 100644 --- a/packages/getstorybookio/package.json +++ b/docs/package.json @@ -3,11 +3,11 @@ "version": "0.0.1", "private": true, "devDependencies": { - "react-scripts": "0.2.1", - "@kadira/storybook": "^2.0.0" + "@kadira/storybook": "*", + "react-scripts": "0.2.1" }, "dependencies": { - "@kadira/storybook-addons": "^1.3.1", + "@kadira/storybook-addons": "*", "airbnb-js-shims": "^1.0.1", "bootstrap": "^3.3.7", "common-tags": "^1.3.1", diff --git a/packages/getstorybookio/src/components/Docs/Container/index.js b/docs/src/components/Docs/Container/index.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/Container/index.js rename to docs/src/components/Docs/Container/index.js diff --git a/packages/getstorybookio/src/components/Docs/Container/style.css b/docs/src/components/Docs/Container/style.css similarity index 100% rename from packages/getstorybookio/src/components/Docs/Container/style.css rename to docs/src/components/Docs/Container/style.css diff --git a/packages/getstorybookio/src/components/Docs/Content/index.js b/docs/src/components/Docs/Content/index.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/Content/index.js rename to docs/src/components/Docs/Content/index.js diff --git a/packages/getstorybookio/src/components/Docs/Content/style.css b/docs/src/components/Docs/Content/style.css similarity index 100% rename from packages/getstorybookio/src/components/Docs/Content/style.css rename to docs/src/components/Docs/Content/style.css diff --git a/packages/getstorybookio/src/components/Docs/Nav/dropdown.js b/docs/src/components/Docs/Nav/dropdown.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/Nav/dropdown.js rename to docs/src/components/Docs/Nav/dropdown.js diff --git a/packages/getstorybookio/src/components/Docs/Nav/index.js b/docs/src/components/Docs/Nav/index.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/Nav/index.js rename to docs/src/components/Docs/Nav/index.js diff --git a/packages/getstorybookio/src/components/Docs/Nav/style.css b/docs/src/components/Docs/Nav/style.css similarity index 100% rename from packages/getstorybookio/src/components/Docs/Nav/style.css rename to docs/src/components/Docs/Nav/style.css diff --git a/packages/getstorybookio/src/components/Docs/Navigation/index.js b/docs/src/components/Docs/Navigation/index.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/Navigation/index.js rename to docs/src/components/Docs/Navigation/index.js diff --git a/packages/getstorybookio/src/components/Docs/Navigation/styles.js b/docs/src/components/Docs/Navigation/styles.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/Navigation/styles.js rename to docs/src/components/Docs/Navigation/styles.js diff --git a/packages/getstorybookio/src/components/Docs/index.js b/docs/src/components/Docs/index.js similarity index 100% rename from packages/getstorybookio/src/components/Docs/index.js rename to docs/src/components/Docs/index.js diff --git a/packages/getstorybookio/src/components/Docs/style.css b/docs/src/components/Docs/style.css similarity index 100% rename from packages/getstorybookio/src/components/Docs/style.css rename to docs/src/components/Docs/style.css diff --git a/packages/getstorybookio/src/components/Homepage/Demo/images/demo.gif b/docs/src/components/Homepage/Demo/images/demo.gif similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Demo/images/demo.gif rename to docs/src/components/Homepage/Demo/images/demo.gif diff --git a/packages/getstorybookio/src/components/Homepage/Demo/index.js b/docs/src/components/Homepage/Demo/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Demo/index.js rename to docs/src/components/Homepage/Demo/index.js diff --git a/packages/getstorybookio/src/components/Homepage/Demo/style.css b/docs/src/components/Homepage/Demo/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Demo/style.css rename to docs/src/components/Homepage/Demo/style.css diff --git a/packages/getstorybookio/src/components/Homepage/Featured/images/airbnb.png b/docs/src/components/Homepage/Featured/images/airbnb.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Featured/images/airbnb.png rename to docs/src/components/Homepage/Featured/images/airbnb.png diff --git a/packages/getstorybookio/src/components/Homepage/Featured/images/rb.png b/docs/src/components/Homepage/Featured/images/rb.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Featured/images/rb.png rename to docs/src/components/Homepage/Featured/images/rb.png diff --git a/packages/getstorybookio/src/components/Homepage/Featured/images/rnw.png b/docs/src/components/Homepage/Featured/images/rnw.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Featured/images/rnw.png rename to docs/src/components/Homepage/Featured/images/rnw.png diff --git a/packages/getstorybookio/src/components/Homepage/Featured/index.js b/docs/src/components/Homepage/Featured/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Featured/index.js rename to docs/src/components/Homepage/Featured/index.js diff --git a/packages/getstorybookio/src/components/Homepage/Featured/style.css b/docs/src/components/Homepage/Featured/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Featured/style.css rename to docs/src/components/Homepage/Featured/style.css diff --git a/packages/getstorybookio/src/components/Homepage/Footer/images/mail-icon.png b/docs/src/components/Homepage/Footer/images/mail-icon.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Footer/images/mail-icon.png rename to docs/src/components/Homepage/Footer/images/mail-icon.png diff --git a/packages/getstorybookio/src/components/Homepage/Footer/images/medium-icon.png b/docs/src/components/Homepage/Footer/images/medium-icon.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Footer/images/medium-icon.png rename to docs/src/components/Homepage/Footer/images/medium-icon.png diff --git a/packages/getstorybookio/src/components/Homepage/Footer/images/slack-icon.png b/docs/src/components/Homepage/Footer/images/slack-icon.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Footer/images/slack-icon.png rename to docs/src/components/Homepage/Footer/images/slack-icon.png diff --git a/packages/getstorybookio/src/components/Homepage/Footer/images/twitter-icon.png b/docs/src/components/Homepage/Footer/images/twitter-icon.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Footer/images/twitter-icon.png rename to docs/src/components/Homepage/Footer/images/twitter-icon.png diff --git a/packages/getstorybookio/src/components/Homepage/Footer/index.js b/docs/src/components/Homepage/Footer/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Footer/index.js rename to docs/src/components/Homepage/Footer/index.js diff --git a/packages/getstorybookio/src/components/Homepage/Footer/style.css b/docs/src/components/Homepage/Footer/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Footer/style.css rename to docs/src/components/Homepage/Footer/style.css diff --git a/packages/getstorybookio/src/components/Homepage/Header/index.js b/docs/src/components/Homepage/Header/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Header/index.js rename to docs/src/components/Homepage/Header/index.js diff --git a/packages/getstorybookio/src/components/Homepage/Header/style.css b/docs/src/components/Homepage/Header/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Header/style.css rename to docs/src/components/Homepage/Header/style.css diff --git a/packages/getstorybookio/src/components/Homepage/Heading/index.js b/docs/src/components/Homepage/Heading/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Heading/index.js rename to docs/src/components/Homepage/Heading/index.js diff --git a/packages/getstorybookio/src/components/Homepage/Heading/style.css b/docs/src/components/Homepage/Heading/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Heading/style.css rename to docs/src/components/Homepage/Heading/style.css diff --git a/packages/getstorybookio/src/components/Homepage/MainLinks/images/docs.png b/docs/src/components/Homepage/MainLinks/images/docs.png similarity index 100% rename from packages/getstorybookio/src/components/Homepage/MainLinks/images/docs.png rename to docs/src/components/Homepage/MainLinks/images/docs.png diff --git a/packages/getstorybookio/src/components/Homepage/MainLinks/index.js b/docs/src/components/Homepage/MainLinks/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/MainLinks/index.js rename to docs/src/components/Homepage/MainLinks/index.js diff --git a/packages/getstorybookio/src/components/Homepage/MainLinks/style.css b/docs/src/components/Homepage/MainLinks/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/MainLinks/style.css rename to docs/src/components/Homepage/MainLinks/style.css diff --git a/packages/getstorybookio/src/components/Homepage/Platforms/index.js b/docs/src/components/Homepage/Platforms/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Platforms/index.js rename to docs/src/components/Homepage/Platforms/index.js diff --git a/packages/getstorybookio/src/components/Homepage/Platforms/style.css b/docs/src/components/Homepage/Platforms/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/Platforms/style.css rename to docs/src/components/Homepage/Platforms/style.css diff --git a/packages/getstorybookio/src/components/Homepage/index.js b/docs/src/components/Homepage/index.js similarity index 100% rename from packages/getstorybookio/src/components/Homepage/index.js rename to docs/src/components/Homepage/index.js diff --git a/packages/getstorybookio/src/components/Homepage/style.css b/docs/src/components/Homepage/style.css similarity index 100% rename from packages/getstorybookio/src/components/Homepage/style.css rename to docs/src/components/Homepage/style.css diff --git a/packages/getstorybookio/src/containers/Docs.js b/docs/src/containers/Docs.js similarity index 100% rename from packages/getstorybookio/src/containers/Docs.js rename to docs/src/containers/Docs.js diff --git a/packages/getstorybookio/src/design/docs/docs-container.png b/docs/src/design/docs/docs-container.png similarity index 100% rename from packages/getstorybookio/src/design/docs/docs-container.png rename to docs/src/design/docs/docs-container.png diff --git a/packages/getstorybookio/src/design/docs/docs-content.png b/docs/src/design/docs/docs-content.png similarity index 100% rename from packages/getstorybookio/src/design/docs/docs-content.png rename to docs/src/design/docs/docs-content.png diff --git a/packages/getstorybookio/src/design/docs/docs-nav.png b/docs/src/design/docs/docs-nav.png similarity index 100% rename from packages/getstorybookio/src/design/docs/docs-nav.png rename to docs/src/design/docs/docs-nav.png diff --git a/packages/getstorybookio/src/design/docs/docs.png b/docs/src/design/docs/docs.png similarity index 100% rename from packages/getstorybookio/src/design/docs/docs.png rename to docs/src/design/docs/docs.png diff --git a/packages/getstorybookio/src/design/homepage/built-for.png b/docs/src/design/homepage/built-for.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/built-for.png rename to docs/src/design/homepage/built-for.png diff --git a/packages/getstorybookio/src/design/homepage/demo.png b/docs/src/design/homepage/demo.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/demo.png rename to docs/src/design/homepage/demo.png diff --git a/packages/getstorybookio/src/design/homepage/featured-storybooks.png b/docs/src/design/homepage/featured-storybooks.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/featured-storybooks.png rename to docs/src/design/homepage/featured-storybooks.png diff --git a/packages/getstorybookio/src/design/homepage/footer.png b/docs/src/design/homepage/footer.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/footer.png rename to docs/src/design/homepage/footer.png diff --git a/packages/getstorybookio/src/design/homepage/header.png b/docs/src/design/homepage/header.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/header.png rename to docs/src/design/homepage/header.png diff --git a/packages/getstorybookio/src/design/homepage/heading.png b/docs/src/design/homepage/heading.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/heading.png rename to docs/src/design/homepage/heading.png diff --git a/packages/getstorybookio/src/design/homepage/homepage.png b/docs/src/design/homepage/homepage.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/homepage.png rename to docs/src/design/homepage/homepage.png diff --git a/packages/getstorybookio/src/design/homepage/main-links.png b/docs/src/design/homepage/main-links.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/main-links.png rename to docs/src/design/homepage/main-links.png diff --git a/packages/getstorybookio/src/design/homepage/screenshot.png b/docs/src/design/homepage/screenshot.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/screenshot.png rename to docs/src/design/homepage/screenshot.png diff --git a/packages/getstorybookio/src/design/homepage/storybook-icon-sqaure.png b/docs/src/design/homepage/storybook-icon-sqaure.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/storybook-icon-sqaure.png rename to docs/src/design/homepage/storybook-icon-sqaure.png diff --git a/packages/getstorybookio/src/design/homepage/storybook-icon.png b/docs/src/design/homepage/storybook-icon.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/storybook-icon.png rename to docs/src/design/homepage/storybook-icon.png diff --git a/packages/getstorybookio/src/design/homepage/storybook-logo.png b/docs/src/design/homepage/storybook-logo.png similarity index 100% rename from packages/getstorybookio/src/design/homepage/storybook-logo.png rename to docs/src/design/homepage/storybook-logo.png diff --git a/packages/getstorybookio/src/docs/index.js b/docs/src/docs/index.js similarity index 100% rename from packages/getstorybookio/src/docs/index.js rename to docs/src/docs/index.js diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/addon-gallery.js b/docs/src/docs/react-storybook/addons/addon-gallery.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/addon-gallery.js rename to docs/src/docs/react-storybook/addons/addon-gallery.js diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/api.js b/docs/src/docs/react-storybook/addons/api.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/api.js rename to docs/src/docs/react-storybook/addons/api.js diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/introduction.js b/docs/src/docs/react-storybook/addons/introduction.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/introduction.js rename to docs/src/docs/react-storybook/addons/introduction.js diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/static/addon-actions-demo.gif b/docs/src/docs/react-storybook/addons/static/addon-actions-demo.gif similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/static/addon-actions-demo.gif rename to docs/src/docs/react-storybook/addons/static/addon-actions-demo.gif diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/static/default-addons.png b/docs/src/docs/react-storybook/addons/static/default-addons.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/static/default-addons.png rename to docs/src/docs/react-storybook/addons/static/default-addons.png diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/static/stories-with-notes.png b/docs/src/docs/react-storybook/addons/static/stories-with-notes.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/static/stories-with-notes.png rename to docs/src/docs/react-storybook/addons/static/stories-with-notes.png diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/static/stories-without-notes.png b/docs/src/docs/react-storybook/addons/static/stories-without-notes.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/static/stories-without-notes.png rename to docs/src/docs/react-storybook/addons/static/stories-without-notes.png diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/static/storybook-components.png b/docs/src/docs/react-storybook/addons/static/storybook-components.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/static/storybook-components.png rename to docs/src/docs/react-storybook/addons/static/storybook-components.png diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/using-addons.js b/docs/src/docs/react-storybook/addons/using-addons.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/using-addons.js rename to docs/src/docs/react-storybook/addons/using-addons.js diff --git a/packages/getstorybookio/src/docs/react-storybook/addons/writing-addons.js b/docs/src/docs/react-storybook/addons/writing-addons.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/addons/writing-addons.js rename to docs/src/docs/react-storybook/addons/writing-addons.js diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/exporting-storybook.js b/docs/src/docs/react-storybook/basics/exporting-storybook.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/exporting-storybook.js rename to docs/src/docs/react-storybook/basics/exporting-storybook.js diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/faq.js b/docs/src/docs/react-storybook/basics/faq.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/faq.js rename to docs/src/docs/react-storybook/basics/faq.js diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/introduction.js b/docs/src/docs/react-storybook/basics/introduction.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/introduction.js rename to docs/src/docs/react-storybook/basics/introduction.js diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/quick-start-guide.js b/docs/src/docs/react-storybook/basics/quick-start-guide.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/quick-start-guide.js rename to docs/src/docs/react-storybook/basics/quick-start-guide.js diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/slow-start-guide.js b/docs/src/docs/react-storybook/basics/slow-start-guide.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/slow-start-guide.js rename to docs/src/docs/react-storybook/basics/slow-start-guide.js diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/static/basic-stories.png b/docs/src/docs/react-storybook/basics/static/basic-stories.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/static/basic-stories.png rename to docs/src/docs/react-storybook/basics/static/basic-stories.png diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/static/screenshot.png b/docs/src/docs/react-storybook/basics/static/screenshot.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/static/screenshot.png rename to docs/src/docs/react-storybook/basics/static/screenshot.png diff --git a/packages/getstorybookio/src/docs/react-storybook/basics/writing-stories.js b/docs/src/docs/react-storybook/basics/writing-stories.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/basics/writing-stories.js rename to docs/src/docs/react-storybook/basics/writing-stories.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/add-custom-head-tags.js b/docs/src/docs/react-storybook/configurations/add-custom-head-tags.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/add-custom-head-tags.js rename to docs/src/docs/react-storybook/configurations/add-custom-head-tags.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/cli-options.js b/docs/src/docs/react-storybook/configurations/cli-options.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/cli-options.js rename to docs/src/docs/react-storybook/configurations/cli-options.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/custom-babel-config.js b/docs/src/docs/react-storybook/configurations/custom-babel-config.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/custom-babel-config.js rename to docs/src/docs/react-storybook/configurations/custom-babel-config.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/custom-webpack-config.js b/docs/src/docs/react-storybook/configurations/custom-webpack-config.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/custom-webpack-config.js rename to docs/src/docs/react-storybook/configurations/custom-webpack-config.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/default-config.js b/docs/src/docs/react-storybook/configurations/default-config.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/default-config.js rename to docs/src/docs/react-storybook/configurations/default-config.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/env-vars.js b/docs/src/docs/react-storybook/configurations/env-vars.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/env-vars.js rename to docs/src/docs/react-storybook/configurations/env-vars.js diff --git a/packages/getstorybookio/src/docs/react-storybook/configurations/serving-static-files.js b/docs/src/docs/react-storybook/configurations/serving-static-files.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/configurations/serving-static-files.js rename to docs/src/docs/react-storybook/configurations/serving-static-files.js diff --git a/packages/getstorybookio/src/docs/react-storybook/index.js b/docs/src/docs/react-storybook/index.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/index.js rename to docs/src/docs/react-storybook/index.js diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/css-style-testing.js b/docs/src/docs/react-storybook/testing/css-style-testing.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/css-style-testing.js rename to docs/src/docs/react-storybook/testing/css-style-testing.js diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/interaction-testing.js b/docs/src/docs/react-storybook/testing/interaction-testing.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/interaction-testing.js rename to docs/src/docs/react-storybook/testing/interaction-testing.js diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/manual-testing.js b/docs/src/docs/react-storybook/testing/manual-testing.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/manual-testing.js rename to docs/src/docs/react-storybook/testing/manual-testing.js diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/react-ui-testing.js b/docs/src/docs/react-storybook/testing/react-ui-testing.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/react-ui-testing.js rename to docs/src/docs/react-storybook/testing/react-ui-testing.js diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/static/login_form.png b/docs/src/docs/react-storybook/testing/static/login_form.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/static/login_form.png rename to docs/src/docs/react-storybook/testing/static/login_form.png diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/static/specs-addon.png b/docs/src/docs/react-storybook/testing/static/specs-addon.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/static/specs-addon.png rename to docs/src/docs/react-storybook/testing/static/specs-addon.png diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/static/storybook-iframe-screenshot.png b/docs/src/docs/react-storybook/testing/static/storybook-iframe-screenshot.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/static/storybook-iframe-screenshot.png rename to docs/src/docs/react-storybook/testing/static/storybook-iframe-screenshot.png diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/static/storybook-screenshot.png b/docs/src/docs/react-storybook/testing/static/storybook-screenshot.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/static/storybook-screenshot.png rename to docs/src/docs/react-storybook/testing/static/storybook-screenshot.png diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/static/storyshots-diff-view.png b/docs/src/docs/react-storybook/testing/static/storyshots-diff-view.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/static/storyshots-diff-view.png rename to docs/src/docs/react-storybook/testing/static/storyshots-diff-view.png diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/static/storyshots-first-run.png b/docs/src/docs/react-storybook/testing/static/storyshots-first-run.png similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/static/storyshots-first-run.png rename to docs/src/docs/react-storybook/testing/static/storyshots-first-run.png diff --git a/packages/getstorybookio/src/docs/react-storybook/testing/structural-testing.js b/docs/src/docs/react-storybook/testing/structural-testing.js similarity index 100% rename from packages/getstorybookio/src/docs/react-storybook/testing/structural-testing.js rename to docs/src/docs/react-storybook/testing/structural-testing.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/comments.js b/docs/src/docs/storybook-hub/basics/comments.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/comments.js rename to docs/src/docs/storybook-hub/basics/comments.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/getting-started.js b/docs/src/docs/storybook-hub/basics/getting-started.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/getting-started.js rename to docs/src/docs/storybook-hub/basics/getting-started.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/github-pr-integration.js b/docs/src/docs/storybook-hub/basics/github-pr-integration.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/github-pr-integration.js rename to docs/src/docs/storybook-hub/basics/github-pr-integration.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/private-or-public-apps.js b/docs/src/docs/storybook-hub/basics/private-or-public-apps.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/private-or-public-apps.js rename to docs/src/docs/storybook-hub/basics/private-or-public-apps.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/security.js b/docs/src/docs/storybook-hub/basics/security.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/security.js rename to docs/src/docs/storybook-hub/basics/security.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/static/authorize-github.png b/docs/src/docs/storybook-hub/basics/static/authorize-github.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/static/authorize-github.png rename to docs/src/docs/storybook-hub/basics/static/authorize-github.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/static/comments-inside-storybook.png b/docs/src/docs/storybook-hub/basics/static/comments-inside-storybook.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/static/comments-inside-storybook.png rename to docs/src/docs/storybook-hub/basics/static/comments-inside-storybook.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/static/github-pr-comment.png b/docs/src/docs/storybook-hub/basics/static/github-pr-comment.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/static/github-pr-comment.png rename to docs/src/docs/storybook-hub/basics/static/github-pr-comment.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/static/github-pr-deploy-link.png b/docs/src/docs/storybook-hub/basics/static/github-pr-deploy-link.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/static/github-pr-deploy-link.png rename to docs/src/docs/storybook-hub/basics/static/github-pr-deploy-link.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/static/storybooks-via-hub.png b/docs/src/docs/storybook-hub/basics/static/storybooks-via-hub.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/static/storybooks-via-hub.png rename to docs/src/docs/storybook-hub/basics/static/storybooks-via-hub.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/basics/static/storybooks-via-pr.png b/docs/src/docs/storybook-hub/basics/static/storybooks-via-pr.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/basics/static/storybooks-via-pr.png rename to docs/src/docs/storybook-hub/basics/static/storybooks-via-pr.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/index.js b/docs/src/docs/storybook-hub/index.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/index.js rename to docs/src/docs/storybook-hub/index.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/management-features/env-variables.js b/docs/src/docs/storybook-hub/management-features/env-variables.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/management-features/env-variables.js rename to docs/src/docs/storybook-hub/management-features/env-variables.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/management-features/private-npm-packages.js b/docs/src/docs/storybook-hub/management-features/private-npm-packages.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/management-features/private-npm-packages.js rename to docs/src/docs/storybook-hub/management-features/private-npm-packages.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/management-features/sharing-storybooks.js b/docs/src/docs/storybook-hub/management-features/sharing-storybooks.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/management-features/sharing-storybooks.js rename to docs/src/docs/storybook-hub/management-features/sharing-storybooks.js diff --git a/packages/getstorybookio/src/docs/storybook-hub/management-features/static/edit-app-button.png b/docs/src/docs/storybook-hub/management-features/static/edit-app-button.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/management-features/static/edit-app-button.png rename to docs/src/docs/storybook-hub/management-features/static/edit-app-button.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/management-features/static/env-vars.png b/docs/src/docs/storybook-hub/management-features/static/env-vars.png similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/management-features/static/env-vars.png rename to docs/src/docs/storybook-hub/management-features/static/env-vars.png diff --git a/packages/getstorybookio/src/docs/storybook-hub/management-features/workspaces.js b/docs/src/docs/storybook-hub/management-features/workspaces.js similarity index 100% rename from packages/getstorybookio/src/docs/storybook-hub/management-features/workspaces.js rename to docs/src/docs/storybook-hub/management-features/workspaces.js diff --git a/packages/getstorybookio/src/index.css b/docs/src/index.css similarity index 100% rename from packages/getstorybookio/src/index.css rename to docs/src/index.css diff --git a/packages/getstorybookio/src/index.js b/docs/src/index.js similarity index 100% rename from packages/getstorybookio/src/index.js rename to docs/src/index.js diff --git a/packages/getstorybookio/src/lib/autolinker.js b/docs/src/lib/autolinker.js similarity index 100% rename from packages/getstorybookio/src/lib/autolinker.js rename to docs/src/lib/autolinker.js diff --git a/packages/getstorybookio/src/lib/highlight.js b/docs/src/lib/highlight.js similarity index 100% rename from packages/getstorybookio/src/lib/highlight.js rename to docs/src/lib/highlight.js diff --git a/packages/getstorybookio/src/stories/data.js b/docs/src/stories/data.js similarity index 100% rename from packages/getstorybookio/src/stories/data.js rename to docs/src/stories/data.js diff --git a/packages/getstorybookio/src/stories/designs.js b/docs/src/stories/designs.js similarity index 100% rename from packages/getstorybookio/src/stories/designs.js rename to docs/src/stories/designs.js diff --git a/packages/getstorybookio/src/stories/implementations.js b/docs/src/stories/implementations.js similarity index 100% rename from packages/getstorybookio/src/stories/implementations.js rename to docs/src/stories/implementations.js diff --git a/packages/getstorybookio/src/stories/index.js b/docs/src/stories/index.js similarity index 100% rename from packages/getstorybookio/src/stories/index.js rename to docs/src/stories/index.js diff --git a/packages/getstorybookio/src/stories/with_design.js b/docs/src/stories/with_design.js similarity index 100% rename from packages/getstorybookio/src/stories/with_design.js rename to docs/src/stories/with_design.js diff --git a/packages/getstorybookio/static.json b/docs/static.json similarity index 100% rename from packages/getstorybookio/static.json rename to docs/static.json diff --git a/packages/examples/cra-storybook/.gitignore b/examples/cra-storybook/.gitignore similarity index 100% rename from packages/examples/cra-storybook/.gitignore rename to examples/cra-storybook/.gitignore diff --git a/packages/examples/cra-storybook/.storybook/config.js b/examples/cra-storybook/.storybook/config.js similarity index 100% rename from packages/examples/cra-storybook/.storybook/config.js rename to examples/cra-storybook/.storybook/config.js diff --git a/packages/examples/cra-storybook/README.md b/examples/cra-storybook/README.md similarity index 100% rename from packages/examples/cra-storybook/README.md rename to examples/cra-storybook/README.md diff --git a/packages/examples/cra-storybook/package.json b/examples/cra-storybook/package.json similarity index 88% rename from packages/examples/cra-storybook/package.json rename to examples/cra-storybook/package.json index 0fc34731d06a..bbc4a63a576b 100644 --- a/packages/examples/cra-storybook/package.json +++ b/examples/cra-storybook/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "private": true, "devDependencies": { - "react-scripts": "0.9.5", - "@kadira/storybook": "*" + "@kadira/storybook": "*", + "react-scripts": "0.9.5" }, "dependencies": { "react": "^15.4.2", diff --git a/packages/examples/cra-storybook/public/favicon.ico b/examples/cra-storybook/public/favicon.ico similarity index 100% rename from packages/examples/cra-storybook/public/favicon.ico rename to examples/cra-storybook/public/favicon.ico diff --git a/packages/examples/cra-storybook/public/index.html b/examples/cra-storybook/public/index.html similarity index 100% rename from packages/examples/cra-storybook/public/index.html rename to examples/cra-storybook/public/index.html diff --git a/packages/examples/cra-storybook/src/App.css b/examples/cra-storybook/src/App.css similarity index 100% rename from packages/examples/cra-storybook/src/App.css rename to examples/cra-storybook/src/App.css diff --git a/packages/examples/cra-storybook/src/App.js b/examples/cra-storybook/src/App.js similarity index 100% rename from packages/examples/cra-storybook/src/App.js rename to examples/cra-storybook/src/App.js diff --git a/packages/examples/cra-storybook/src/App.test.js b/examples/cra-storybook/src/App.test.js similarity index 100% rename from packages/examples/cra-storybook/src/App.test.js rename to examples/cra-storybook/src/App.test.js diff --git a/packages/examples/cra-storybook/src/index.css b/examples/cra-storybook/src/index.css similarity index 100% rename from packages/examples/cra-storybook/src/index.css rename to examples/cra-storybook/src/index.css diff --git a/packages/examples/cra-storybook/src/index.js b/examples/cra-storybook/src/index.js similarity index 62% rename from packages/examples/cra-storybook/src/index.js rename to examples/cra-storybook/src/index.js index 54c5ef1a427a..5d76a18a8534 100644 --- a/packages/examples/cra-storybook/src/index.js +++ b/examples/cra-storybook/src/index.js @@ -3,7 +3,4 @@ import ReactDOM from 'react-dom'; import App from './App'; import './index.css'; -ReactDOM.render( - , - document.getElementById('root') -); +ReactDOM.render(, document.getElementById('root')); diff --git a/packages/examples/cra-storybook/src/logo.svg b/examples/cra-storybook/src/logo.svg similarity index 100% rename from packages/examples/cra-storybook/src/logo.svg rename to examples/cra-storybook/src/logo.svg diff --git a/packages/examples/cra-storybook/src/stories/Button.js b/examples/cra-storybook/src/stories/Button.js similarity index 87% rename from packages/examples/cra-storybook/src/stories/Button.js rename to examples/cra-storybook/src/stories/Button.js index 5662b882632a..f4288d393484 100644 --- a/packages/examples/cra-storybook/src/stories/Button.js +++ b/examples/cra-storybook/src/stories/Button.js @@ -11,10 +11,7 @@ const buttonStyles = { }; const Button = ({ children, onClick }) => ( - ); diff --git a/packages/examples/cra-storybook/src/stories/Welcome.js b/examples/cra-storybook/src/stories/Welcome.js similarity index 64% rename from packages/examples/cra-storybook/src/stories/Welcome.js rename to examples/cra-storybook/src/stories/Welcome.js index 2170d7b27c66..5886c30148ad 100644 --- a/packages/examples/cra-storybook/src/stories/Welcome.js +++ b/examples/cra-storybook/src/stories/Welcome.js @@ -22,8 +22,8 @@ const styles = { code: { fontSize: 15, fontWeight: 600, - padding: "2px 5px", - border: "1px solid #eae9e9", + padding: '2px 5px', + border: '1px solid #eae9e9', borderRadius: 4, backgroundColor: '#f3f2f2', color: '#3a3a3a', @@ -33,7 +33,7 @@ const styles = { backgroundColor: '#f3f2f2', padding: '1px 10px', margin: '10px 0', - } + }, }; const codeBlock = ` @@ -51,7 +51,7 @@ storiesOf('App', module) export default class Welcome extends React.Component { showApp(e) { e.preventDefault(); - if(this.props.showApp) this.props.showApp(); + if (this.props.showApp) this.props.showApp(); } render() { @@ -62,14 +62,25 @@ export default class Welcome extends React.Component { This is a UI component dev environment for your app.

- We've added some basic stories inside the src/stories directory. -
+ We've added some basic stories inside the + {' '} + src/stories + {' '} + directory. +
A story is a single state of one or more UI components. You can have as many stories as you want. -
+
(Basically a story is like a visual test case.)

- See these sample stories for a component called Button. + See these sample + {' '} + stories + {' '} + for a component called + {' '} + Button + .

Just like that, you can add your own components as stories. @@ -77,12 +88,22 @@ export default class Welcome extends React.Component { Here's how to add your App component as a story.

${codeBlock}`}} + dangerouslySetInnerHTML={{ __html: `
${codeBlock}
` }} />

Usually we create stories with smaller UI components in the app.
- Have a look at the Writing Stories section in our documentation. + Have a look at the + {' '} + + Writing Stories + + {' '} + section in our documentation.

); diff --git a/examples/cra-storybook/src/stories/index.js b/examples/cra-storybook/src/stories/index.js new file mode 100644 index 000000000000..ee5770241712 --- /dev/null +++ b/examples/cra-storybook/src/stories/index.js @@ -0,0 +1,10 @@ +import React from 'react'; +import { storiesOf, action, linkTo } from '@kadira/storybook'; +import Button from './Button'; +import Welcome from './Welcome'; + +storiesOf('Welcome', module).add('to Storybook', () => ); + +storiesOf('Button', module) + .add('with text', () => ) + .add('with some emoji', () => ); diff --git a/packages/examples/package.json b/examples/package.json similarity index 87% rename from packages/examples/package.json rename to examples/package.json index 78d38ef15f35..f11f22222c4e 100644 --- a/packages/examples/package.json +++ b/examples/package.json @@ -4,7 +4,6 @@ "description": "A set of examples of how to use storybook, also used for regression testing", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 0", "test:automated-cra-storybook": "node scripts/automated-cra-storybook.js" }, "license": "ISC", diff --git a/packages/examples/scripts/automated-cra-storybook.js b/examples/scripts/automated-cra-storybook.js similarity index 100% rename from packages/examples/scripts/automated-cra-storybook.js rename to examples/scripts/automated-cra-storybook.js diff --git a/lerna.json b/lerna.json index 0807230f06cb..bdd5c9c12172 100644 --- a/lerna.json +++ b/lerna.json @@ -3,6 +3,6 @@ "version": "3.0.0", "packages": [ "packages/*", - "packages/examples/*" + "examples/*" ] } diff --git a/package.json b/package.json index c9cff6725965..f666e60f96cc 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,28 @@ "name": "storybook", "devDependencies": { "babel-eslint": "^7.2.2", + "codecov": "^2.1.0", + "enzyme": "^2.8.2", + "enzyme-to-json": "^1.5.1", "eslint": "^3.19.0", "eslint-config-airbnb-base": "^11.1.3", "eslint-plugin-import": "^2.2.0", + "eslint-plugin-jest": "^19.0.1", "eslint-plugin-prettier": "^2.0.1", + "jest": "^19.0.2", + "jest-enzyme": "^3.0.1", "lerna": "2.0.0-rc.2", - "prettier": "^1.1.0" + "prettier": "^1.1.0", + "react": "^15.5.4", + "react-addons-test-utils": "^15.5.1", + "react-dom": "^15.5.4" }, "scripts": { - "postinstall": "lerna bootstrap", - "test": "lerna run test", - "lint": "eslint ." + "postinstall": "lerna bootstrap --hoist", + "lint": "eslint .", + "test": "jest --config ./.jestrc", + "test:watch": "npm test -- --watch", + "test-examples": "CI=true lerna run test", + "coverage": "codecov" } } diff --git a/packages/addon-actions/package.json b/packages/addon-actions/package.json index 40f1977ff4cc..e03a981188d7 100644 --- a/packages/addon-actions/package.json +++ b/packages/addon-actions/package.json @@ -6,8 +6,7 @@ "scripts": { "deploy-storybook": "storybook-to-ghpages", "prepublish": "node .scripts/npm-prepublish.js", - "storybook": "start-storybook -p 9001", - "test": "echo \"Error: no test specified\" && exit 0" + "storybook": "start-storybook -p 9001" }, "repository": { "type": "git", @@ -22,9 +21,9 @@ }, "homepage": "https://github.com/kadirahq/storybook-addon-actions#readme", "devDependencies": { - "@kadira/storybook": "^2.20.1", - "@kadira/storybook-addons": "^1.3.0", - "@kadira/storybook-ui": "^3.0.0", + "@kadira/storybook": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-ui": "*", "babel-cli": "^6.11.4", "babel-preset-es2015": "^6.9.0", "babel-preset-react": "^6.11.1", @@ -41,7 +40,7 @@ "react-inspector": "^1.1.0" }, "peerDependencies": { - "@kadira/storybook-addons": "^1.3.0", + "@kadira/storybook-addons": "*", "react": "*", "react-dom": "*" } diff --git a/packages/addon-comments/package.json b/packages/addon-comments/package.json index e8e1fe32c6de..19f5a8b63cf1 100644 --- a/packages/addon-comments/package.json +++ b/packages/addon-comments/package.json @@ -5,7 +5,6 @@ "main": "preview.js", "scripts": { "prepublish": ". ./.scripts/prepublish.sh", - "test": "mocha --require .scripts/mocha_runner src/**/tests/**/*.js", "storybook": "start-storybook -p 3006", "storybook-local": "STORYBOOK_CLOUD_SERVER='http://localhost:3003/graphql' start-storybook -p 9010", "storybook-remote": "start-storybook -p 3006", @@ -24,34 +23,28 @@ }, "homepage": "https://github.com/kadirahq/storybook-addon-comments#readme", "devDependencies": { - "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-test-renderer": "^15.5.4", - "babel-loader": "^6.2.5", - "babel-polyfill": "^6.13.0", - "babel-preset-react-app": "^0.2.1", + "@kadira/storybook": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-database-cloud": "*", + "@kadira/storybook-deployer": "*", + "@kadira/storybook-ui": "*", "babel-cli": "^6.14.0", "babel-core": "^6.14.0", + "babel-loader": "^6.2.5", "babel-plugin-transform-runtime": "^6.15.0", + "babel-polyfill": "^6.13.0", "babel-preset-es2015": "^6.14.0", "babel-preset-react": "^6.11.1", + "babel-preset-react-app": "^0.2.1", "babel-preset-stage-0": "^6.5.0", - "mocha": "^3.0.2", - "chai": "^3.5.0", - "sinon": "^1.17.6", - "enzyme": "^2.2.0", - "jsdom": "^9.5.0", "git-url-parse": "^6.0.1", - "@kadira/storybook": "^2.24.1", - "@kadira/storybook-addons": "^1.5.0", - "@kadira/storybook-database-cloud": "^2.3.1", - "@kadira/storybook-deployer": "^1.2.0", - "@kadira/storybook-ui": "^3.4.1", - "chokidar": "^1.6.0", + "react": "^15.5.4", + "react-dom": "^15.5.4", + "react-test-renderer": "^15.5.4", "shelljs": "^0.7.4" }, "peerDependencies": { - "@kadira/storybook-addons": "^1.5.0", + "@kadira/storybook-addons": "*", "react": "*", "react-dom": "*" }, diff --git a/packages/addon-comments/src/manager/components/CommentItem/index.js b/packages/addon-comments/src/manager/components/CommentItem/index.js index 023c451eb9ea..104a6ac9fcb8 100644 --- a/packages/addon-comments/src/manager/components/CommentItem/index.js +++ b/packages/addon-comments/src/manager/components/CommentItem/index.js @@ -1,6 +1,4 @@ import PropTypes from 'prop-types'; -/* eslint jsx-a11y/href-no-hash:0, no-undef:0, no-alert:0 */ - import React, { Component } from 'react'; import moment from 'moment'; import renderHTML from 'react-render-html'; diff --git a/packages/addon-comments/src/manager/components/CommentsPanel/index.js b/packages/addon-comments/src/manager/components/CommentsPanel/index.js index 0c09975c852f..fb9ffff226c7 100644 --- a/packages/addon-comments/src/manager/components/CommentsPanel/index.js +++ b/packages/addon-comments/src/manager/components/CommentsPanel/index.js @@ -1,6 +1,4 @@ import PropTypes from 'prop-types'; -/* eslint no-undef: 0 */ - import React, { Component } from 'react'; import CommentList from '../CommentList'; import CommentForm from '../CommentForm'; diff --git a/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js b/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js index 17e1a13d6baa..25707d1bc564 100644 --- a/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js +++ b/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.js @@ -1,5 +1,3 @@ -/* eslint no-param-reassign:0 */ - import deepEquals from 'deep-equal'; import { EventEmitter } from 'events'; @@ -27,7 +25,12 @@ export default class DataStore { const key = this._getStoryKey(currentStory); const item = this.cache[key]; - if (!item) return null; + if (!item) { + return { + comments: [], + invalidated: false, + }; + } const comments = item.comments; let invalidated = false; @@ -67,9 +70,9 @@ export default class DataStore { this._fireComments(item.comments); // if the cache invalidated we need to load comments again. if (item.invalidated) { - this._loadUsers().then(() => this._loadComments()); + return this._loadUsers().then(() => this._loadComments()); } - return; + return Promise.resolve(null); } // load comments for the first time. @@ -117,7 +120,6 @@ export default class DataStore { // add to cache this._addToCache(currentStory, comments); - /* eslint no-param-reassign:0 */ // set comments only if we are on the relavant story if (deepEquals(currentStory, this.currentStory)) { this._fireComments(comments); @@ -202,7 +204,7 @@ export default class DataStore { } addComment(comment) { - this._addAuthorToTheDatabase() + return this._addAuthorToTheDatabase() .then(() => this._addPendingComment(comment)) .then(() => this._addCommentToDatabase(comment)) .then(() => this._loadUsers()) @@ -210,7 +212,7 @@ export default class DataStore { } deleteComment(commentId) { - this._setDeletedComment(commentId) + return this._setDeletedComment(commentId) .then(() => this._deleteCommentOnDatabase(commentId)) .then(() => this._loadComments()); } diff --git a/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.test.js b/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.test.js new file mode 100644 index 000000000000..0e9621e056a1 --- /dev/null +++ b/packages/addon-comments/src/manager/containers/CommentsPanel/dataStore.test.js @@ -0,0 +1,89 @@ +import DataStore from './dataStore'; + +const user = { + id: 'user-id', + name: 'user-name', +}; + +const dbGetUsers = jest.fn(a => Promise.resolve([user])); +const dbSetUsers = jest.fn(a => Promise.resolve(a)); +const dbGetComments = jest.fn(a => Promise.resolve(a)); +const dbSetComments = jest.fn(a => Promise.resolve(a)); + +const db = { + getCollection(namespace) { + switch (namespace) { + case 'users': { + return { + get: dbGetUsers, + set: dbGetUsers, + }; + } + case 'comments': { + return { + get: dbGetComments, + set: dbSetComments, + }; + } + } + }, + persister: { + _getAppInfo() { + return Promise.resolve(true); + }, + }, +}; + +const theStore = new DataStore(db); + +describe('DataStore', () => { + it('set current story - when user not logged in', () => { + theStore.setCurrentStory('Components', 'CommentList - No Comments'); + + expect(theStore.currentStory).toEqual({ + sbKind: 'Components', + sbStory: 'CommentList - No Comments', + }); + }); + + it('set current user', () => { + theStore.setCurrentUser({ + id: 'user-id', + name: 'user-name', + }); + + expect(theStore.user).toEqual({ id: 'user-id', name: 'user-name' }); + }); + + it('set current story - when user already logged in', () => { + theStore.setCurrentStory('Components', 'CommentList - No Comments'); + + expect(theStore.currentStory).toEqual({ + sbKind: 'Components', + sbStory: 'CommentList - No Comments', + }); + }); + + it('add comment', async () => { + theStore.setCurrentStory('Components', 'CommentList - No Comments'); + const comment = { + text: 'sample comment', + time: 1476435982029, + userId: 'user-id', + }; + + await theStore.addComment(comment); + + expect(dbGetComments).toHaveBeenCalled(); + expect(dbSetComments).toHaveBeenCalled(); + }); + + it('onComments', () => { + const callback = comments => comments; + const stopper = theStore.onComments(callback); + expect(theStore.callbacks).toContain(callback); + + expect(stopper).not.toThrow(); + expect(theStore.callbacks).not.toContain(callback); + }); +}); diff --git a/packages/addon-comments/src/manager/containers/CommentsPanel/index.js b/packages/addon-comments/src/manager/containers/CommentsPanel/index.js index dcb5ef8d23de..a84a9b069e1a 100644 --- a/packages/addon-comments/src/manager/containers/CommentsPanel/index.js +++ b/packages/addon-comments/src/manager/containers/CommentsPanel/index.js @@ -1,9 +1,6 @@ import PropTypes from 'prop-types'; -/* eslint no-unused-vars:0 */ - import React, { Component } from 'react'; import addons from '@kadira/storybook-addons'; -// import deepEquals from 'deep-equal'; import CommentsPanel from '../../components/CommentsPanel/'; import DataStore from './dataStore'; diff --git a/packages/addon-comments/src/preview/index.js b/packages/addon-comments/src/preview/index.js index 958a9fa55594..ef02c79ddf99 100644 --- a/packages/addon-comments/src/preview/index.js +++ b/packages/addon-comments/src/preview/index.js @@ -1,5 +1 @@ -/* eslint import/prefer-default-export:0 */ - -export function init() { - // nothing to do here -} +export const init = () => {}; diff --git a/packages/addon-comments/src/tests/dataStore.js b/packages/addon-comments/src/tests/dataStore.js deleted file mode 100644 index 110de0afed7d..000000000000 --- a/packages/addon-comments/src/tests/dataStore.js +++ /dev/null @@ -1,81 +0,0 @@ -// import { shallow, mount } from 'enzyme'; -import { expect } from 'chai'; -import sinon from 'sinon'; -import addons from '@kadira/storybook-addons'; -import DataStore from '../manager/containers/CommentsPanel/dataStore'; - -const { describe, it } = global; - -const dbGetPromiseReturn = sinon.stub(); -const dbSetPromiseReturn = sinon.stub(); - -const myDb = { - getCollection() { - return { - get() { - return new Promise(dbGetPromiseReturn); - }, - set() { - return new Promise(dbSetPromiseReturn); - }, - }; - }, - persister: { - _getAppInfo() { - return Promise.resolve(true); - }, - }, -}; -addons.setDatabase(myDb); - -const db = addons.getDatabase(); -const theStore = new DataStore(db); - -describe('DataStore', () => { - it('set current story - when user not logged in', () => { - theStore.setCurrentStory('Components', 'CommentList - No Comments'); - - expect(dbGetPromiseReturn.called).to.equal(false); - expect(theStore.currentStory).to.deep.equal({ - sbKind: 'Components', - sbStory: 'CommentList - No Comments', - }); - }); - - it('set current user', () => { - theStore.setCurrentUser({ - id: 'user-id', - name: 'user-name', - }); - - expect(theStore.user).to.deep.equal({ id: 'user-id', name: 'user-name' }); - }); - - it('set current story - when user already logged in', () => { - theStore.setCurrentStory('Components', 'CommentList - No Comments'); - - expect(dbGetPromiseReturn.called).to.equal(true); - expect(theStore.currentStory).to.deep.equal({ - sbKind: 'Components', - sbStory: 'CommentList - No Comments', - }); - }); - - it('add comment', () => { - const comment = { - text: 'sample comment', - time: 1476435982029, - userId: 'user-id', - }; - - theStore.addComment(comment); - - expect(dbGetPromiseReturn.called).to.equal(true); - expect(dbSetPromiseReturn.called).to.equal(true); - }); - - it('onComments', () => { - theStore.onComments(comments => comments); - expect(dbGetPromiseReturn.called).to.equal(true); - }); -}); diff --git a/packages/addon-graphql/demo/package.json b/packages/addon-graphql/demo/package.json index 66d0f0becfce..29faf48a4a3e 100644 --- a/packages/addon-graphql/demo/package.json +++ b/packages/addon-graphql/demo/package.json @@ -3,9 +3,6 @@ "version": "1.0.0", "description": "", "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, "keywords": [], "author": "Muhammed Thanish (http://thanish.me/)", "license": "MIT", diff --git a/packages/addon-graphql/package.json b/packages/addon-graphql/package.json index f071b3115bd6..3c509b483f88 100644 --- a/packages/addon-graphql/package.json +++ b/packages/addon-graphql/package.json @@ -6,8 +6,7 @@ "scripts": { "deploy-storybook": "storybook-to-ghpages", "prepublish": "node .scripts/npm-prepublish.js", - "storybook": "start-storybook -p 9001", - "test": "echo \"Error: no test specified\" && exit 0" + "storybook": "start-storybook -p 9001" }, "repository": { "type": "git", @@ -22,7 +21,7 @@ }, "homepage": "https://github.com/kadirahq/storybook-addon-graphql#readme", "devDependencies": { - "@kadira/storybook": "^2.20.1", + "@kadira/storybook": "*", "babel-cli": "^6.11.4", "babel-preset-es2015": "^6.9.0", "babel-preset-react": "^6.11.1", @@ -32,7 +31,7 @@ "shelljs": "^0.7.3" }, "peerDependencies": { - "@kadira/storybook-addons": "^1.3.0", + "@kadira/storybook-addons": "*", "react": "*" }, "dependencies": { diff --git a/packages/addon-info/package.json b/packages/addon-info/package.json index 580ffa67318e..c847b85b515e 100644 --- a/packages/addon-info/package.json +++ b/packages/addon-info/package.json @@ -9,13 +9,11 @@ "license": "MIT", "scripts": { "prepublish": ". ./.scripts/prepublish.sh", - "test": "mocha --require .scripts/mocha_runner src/**/tests/**/*.js", - "test-watch": "npm run testonly -- --watch --watch-extensions js", "storybook": "start-storybook -p 9010", "publish-storybook": "bash .scripts/publish_storybook.sh" }, "devDependencies": { - "@kadira/storybook": "^2.20.1", + "@kadira/storybook": "*", "babel-cli": "^6.5.0", "babel-core": "^6.5.0", "babel-eslint": "^7.0.0", @@ -24,19 +22,15 @@ "babel-preset-es2015": "^6.5.0", "babel-preset-react": "^6.5.0", "babel-preset-stage-2": "^6.5.0", - "chai": "^3.5.0", - "enzyme": "^2.2.0", "git-url-parse": "^6.0.1", - "jsdom": "^9.5.0", - "mocha": "^3.0.2", "react": "^15.5.4", "react-dom": "^15.5.4", - "react-test-renderer": "^15.5.4", "react-storybook-addon-backgrounds": "0.0.7", - "sinon": "^1.17.6" + "react-test-renderer": "^15.5.4" }, "peerDependencies": { - "react": "*" + "react": "*", + "react-dom": "*" }, "dependencies": { "babel-runtime": "^6.5.0", diff --git a/packages/addon-info/src/tests/index.js b/packages/addon-info/src/tests/index.js deleted file mode 100644 index 5cfdacbafc39..000000000000 --- a/packages/addon-info/src/tests/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import { shallow, mount } from 'enzyme'; -import Story from '../index'; -import { expect } from 'chai'; -import sinon from 'sinon'; -const { describe, it } = global; - -describe('Story', () => { - it('should show the info button'); -}); diff --git a/packages/addon-knobs/.scripts/mocha_runner.js b/packages/addon-knobs/.scripts/mocha_runner.js deleted file mode 100644 index 87d88197cbc9..000000000000 --- a/packages/addon-knobs/.scripts/mocha_runner.js +++ /dev/null @@ -1,33 +0,0 @@ -// IMPORTANT -// --------- -// This is an auto generated file with React CDK. -// Do not modify this file. -// Use `.scripts/user/pretest.js instead`. - -require('babel-core/register'); -require('babel-polyfill'); - -// Add jsdom support, which is required for enzyme. -var jsdom = require('jsdom').jsdom; - -var exposedProperties = ['window', 'navigator', 'document']; - -global.document = jsdom(''); -global.window = document.defaultView; -Object.keys(document.defaultView).forEach((property) => { - if (typeof global[property] === 'undefined') { - exposedProperties.push(property); - global[property] = document.defaultView[property]; - } -}); - -global.navigator = { - userAgent: 'node.js' -}; - -process.on('unhandledRejection', function (error) { - console.error('Unhandled Promise Rejection:'); - console.error(error && error.stack || error); -}); - -require('./user/pretest.js'); diff --git a/packages/addon-knobs/package.json b/packages/addon-knobs/package.json index 799c2ba9a218..e39c43ed932e 100644 --- a/packages/addon-knobs/package.json +++ b/packages/addon-knobs/package.json @@ -10,57 +10,45 @@ "scripts": { "start": "./example/prepublish.sh", "prepublish": ". ./.scripts/prepublish.sh", - "test": "mocha --require ./.scripts/mocha_runner ./src/**/tests/**/*.js", - "test-watch": "npm run testonly -- --watch --watch-extensions js", "storybook": "start-storybook -p 9010", "publish-storybook": "bash .scripts/publish_storybook.sh" }, "devDependencies": { - "@kadira/storybook": "^2.1.0", - "@types/mocha": "^2.2.32", - "@types/node": "^6.0.46", - "@types/react": "^0.14.42", - "babel-cli": "^6.5.0", - "babel-core": "^6.5.0", - "babel-eslint": "^7.0.0", - "babel-loader": "^6.2.4", - "babel-plugin-transform-runtime": "^6.5.0", - "babel-polyfill": "^6.5.0", - "babel-preset-es2015": "^6.5.0", - "babel-preset-react": "^6.5.0", - "babel-preset-stage-2": "^6.5.0", - "chai": "^3.5.0", - "enzyme": "^2.2.0", - "git-url-parse": "^6.0.1", - "jsdom": "^8.3.1", - "mocha": "^3.1.0", + "@kadira/storybook": "*", + "@types/node": "^7.0.12", + "@types/react": "^15.0.21", + "babel-cli": "^6.24.1", + "babel-core": "^6.24.1", + "babel-eslint": "^7.2.2", + "babel-loader": "^6.4.1", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-polyfill": "^6.23.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-2": "^6.24.1", + "git-url-parse": "^6.2.2", "raw-loader": "^0.5.1", "react": "^15.5.4", "react-dom": "^15.5.4", - "react-test-renderer": "^15.5.4", - "sinon": "^1.17.3", "style-loader": "^0.13.1", - "typescript": "^2.0.6", + "typescript": "^2.2.2", "typescript-definition-tester": "^0.0.5" }, "peerDependencies": { - "@kadira/storybook-addons": "^1.3.0", + "@kadira/storybook-addons": "*", "react": "*", "react-dom": "*" }, "dependencies": { - "babel-runtime": "^6.5.0", + "babel-runtime": "^6.23.0", "deep-equal": "^1.0.1", "insert-css": "^1.0.0", - "moment": "^2.15.0", - "prop-types": "^15.5.7", - "react-color": "^2.4.3", - "react-datetime": "^2.6.0", + "moment": "^2.18.1", + "prop-types": "^15.5.8", + "react-color": "^2.11.4", + "react-datetime": "^2.8.9", "react-textarea-autosize": "^4.0.5" }, "main": "dist/index.js", - "engines": { - "npm": "^3.0.0" - }, "typings": "./storybook-addon-knobs.d.ts" } diff --git a/packages/addon-knobs/src/tests/KnobManager.js b/packages/addon-knobs/src/KnobManager.test.js similarity index 72% rename from packages/addon-knobs/src/tests/KnobManager.js rename to packages/addon-knobs/src/KnobManager.test.js index 7e248d081284..43a0f522ae08 100644 --- a/packages/addon-knobs/src/tests/KnobManager.js +++ b/packages/addon-knobs/src/KnobManager.test.js @@ -1,9 +1,6 @@ import React from 'react'; -import sinon from 'sinon'; -import { expect } from 'chai'; import { shallow } from 'enzyme'; -import KnobManager from '../KnobManager'; -const { describe, it, beforeEach } = global; +import KnobManager from './KnobManager'; describe('KnobManager', () => { describe('knob()', () => { @@ -12,7 +9,7 @@ describe('KnobManager', () => { beforeEach(() => { testManager.knobStore = { - set: sinon.spy(), + set: jest.fn(), get: () => ({ defaultValue: 'default value', value: 'current value', @@ -27,8 +24,8 @@ describe('KnobManager', () => { value: 'default value', }; const knob = testManager.knob('foo', defaultKnob); - expect(knob).to.equal('current value'); - expect(testManager.knobStore.set.callCount).to.equal(0); + expect(knob).toEqual('current value'); + expect(testManager.knobStore.set).not.toHaveBeenCalled(); }); it('should return the new default knob value when default has changed', () => { @@ -43,7 +40,7 @@ describe('KnobManager', () => { defaultValue: defaultKnob.value, }; - expect(testManager.knobStore.set.calledWith('foo', newKnob)).to.equal(true); + expect(testManager.knobStore.set).toHaveBeenCalledWith('foo', newKnob); }); }); @@ -52,12 +49,13 @@ describe('KnobManager', () => { beforeEach(() => { testManager.knobStore = { - set: sinon.spy(), - get: sinon.stub(), + set: jest.fn(), + get: jest.fn(), }; - testManager.knobStore.get.onFirstCall().returns(undefined); - testManager.knobStore.get.onSecondCall().returns('normal value'); + testManager.knobStore.get + .mockImplementationOnce(() => undefined) + .mockImplementationOnce(() => 'normal value'); }); it('should return the new default knob value when default has changed', () => { @@ -72,7 +70,7 @@ describe('KnobManager', () => { defaultValue: defaultKnob.value, }; - expect(testManager.knobStore.set.calledWith('foo', newKnob)).to.equal(true); + expect(testManager.knobStore.set).toHaveBeenCalledWith('foo', newKnob); }); }); }); @@ -89,11 +87,11 @@ describe('KnobManager', () => { }; const wrappedStory = testManager.wrapStory(testChannel, testStory, testContext); const wrapper = shallow(wrappedStory); - expect(wrapper.find('#test-story')).to.have.length(1); + expect(wrapper.find('#test-story').length).toBe(1); const storyWrapperProps = wrappedStory.props; - expect(storyWrapperProps.channel).to.equal(testChannel); - expect(storyWrapperProps.context).to.equal(testContext); + expect(storyWrapperProps.channel).toEqual(testChannel); + expect(storyWrapperProps.context).toEqual(testContext); }); }); }); diff --git a/packages/addon-knobs/src/components/tests/Array.js b/packages/addon-knobs/src/components/__tests__/Array.js similarity index 68% rename from packages/addon-knobs/src/components/tests/Array.js rename to packages/addon-knobs/src/components/__tests__/Array.js index bd5c6971af5c..5547ca9cc17e 100644 --- a/packages/addon-knobs/src/components/tests/Array.js +++ b/packages/addon-knobs/src/components/__tests__/Array.js @@ -1,13 +1,10 @@ import React from 'react'; import { shallow } from 'enzyme'; import Array from '../types/Array'; -import { expect } from 'chai'; -import sinon from 'sinon'; -const { describe, it } = global; describe('Array', () => { it('should subscribe to setKnobs event of channel', () => { - const onChange = sinon.spy(); + const onChange = jest.fn(); const wrapper = shallow( { ); wrapper.simulate('change', { target: { value: 'Fhishing,Skiing,Dancing' } }); - expect(onChange.calledWith(['Fhishing', 'Skiing', 'Dancing'])).to.equal(true); + expect(onChange).toHaveBeenCalledWith(['Fhishing', 'Skiing', 'Dancing']); }); }); diff --git a/packages/addon-knobs/src/components/tests/Panel.js b/packages/addon-knobs/src/components/__tests__/Panel.js similarity index 78% rename from packages/addon-knobs/src/components/tests/Panel.js rename to packages/addon-knobs/src/components/__tests__/Panel.js index a53d9d9b4913..4198d0cf236e 100644 --- a/packages/addon-knobs/src/components/tests/Panel.js +++ b/packages/addon-knobs/src/components/__tests__/Panel.js @@ -1,15 +1,12 @@ import React from 'react'; import { shallow } from 'enzyme'; import Panel from '../Panel'; -import { expect } from 'chai'; -import sinon from 'sinon'; -const { describe, it } = global; describe('Panel', () => { it('should subscribe to setKnobs event of channel', () => { - const testChannel = { on: sinon.spy() }; + const testChannel = { on: jest.fn() }; shallow(); - expect(testChannel.on.calledWith('addon:knobs:setKnobs')).to.equal(true); + expect(testChannel.on).toHaveBeenCalledWith('addon:knobs:setKnobs', jasmine.any(Function)); }); describe('setKnobs handler', () => { @@ -20,7 +17,7 @@ describe('Panel', () => { on: (e, handler) => { handlers[e] = handler; }, - emit: sinon.spy(), + emit: jest.fn(), }; const testQueryParams = { @@ -30,7 +27,7 @@ describe('Panel', () => { const testApi = { getQueryParam: key => testQueryParams[key], - setQueryParams: sinon.spy(), + setQueryParams: jest.fn(), }; shallow(); @@ -56,7 +53,7 @@ describe('Panel', () => { type: 'text', }; const e = 'addon:knobs:knobChange'; - expect(testChannel.emit.calledWith(e, knobFromUrl)).to.equal(true); + expect(testChannel.emit).toHaveBeenCalledWith(e, knobFromUrl); }); it('should set query params when url params are already read', () => { @@ -66,7 +63,7 @@ describe('Panel', () => { on: (e, handler) => { handlers[e] = handler; }, - emit: sinon.spy(), + emit: jest.fn(), }; const testQueryParams = { @@ -76,7 +73,7 @@ describe('Panel', () => { const testApi = { getQueryParam: key => testQueryParams[key], - setQueryParams: sinon.spy(), + setQueryParams: jest.fn(), }; const wrapper = shallow(); @@ -104,20 +101,20 @@ describe('Panel', () => { 'knob-baz': knobs.baz.value, }; - expect(testApi.setQueryParams.calledWith(knobFromStory)).to.equal(true); + expect(testApi.setQueryParams).toHaveBeenCalledWith(knobFromStory); }); }); describe('handleChange()', () => { it('should set queryParams and emit knobChange event', () => { const testChannel = { - on: sinon.spy(), - emit: sinon.spy(), + on: jest.fn(), + emit: jest.fn(), }; const testApi = { - getQueryParam: sinon.spy(), - setQueryParams: sinon.spy(), + getQueryParam: jest.fn(), + setQueryParams: jest.fn(), }; const wrapper = shallow(); @@ -128,10 +125,10 @@ describe('Panel', () => { type: 'text', }; wrapper.instance().handleChange(testChangedKnob); - expect(testChannel.emit.calledWith('addon:knobs:knobChange', testChangedKnob)).to.equal(true); + expect(testChannel.emit).toHaveBeenCalledWith('addon:knobs:knobChange', testChangedKnob); const paramsChange = { 'knob-foo': 'changed text' }; - expect(testApi.setQueryParams.calledWith(paramsChange)).to.equal(true); + expect(testApi.setQueryParams).toHaveBeenCalledWith(paramsChange); }); }); }); diff --git a/packages/addon-knobs/src/tests/typescript.js b/packages/addon-knobs/src/tests/typescript.js deleted file mode 100644 index c8ebe6406be6..000000000000 --- a/packages/addon-knobs/src/tests/typescript.js +++ /dev/null @@ -1,15 +0,0 @@ -import * as tt from 'typescript-definition-tester'; -const { describe, it } = global; - -describe('TypeScript definitions', function() { - this.timeout(0); - - it('should compile against index.d.ts', done => { - // This will test any typescript files in /examples/typescript against the type declarations. - tt.compileDirectory( - `${__dirname}/../../example/typescript`, - fileName => fileName.match(/\.ts$/), - () => done(), - ); - }); -}); diff --git a/packages/addon-knobs/src/typescript.test.js b/packages/addon-knobs/src/typescript.test.js new file mode 100644 index 000000000000..a757bce70fb3 --- /dev/null +++ b/packages/addon-knobs/src/typescript.test.js @@ -0,0 +1,11 @@ +import * as tt from 'typescript-definition-tester'; + +describe('TypeScript definitions', () => { + it('should compile against index.d.ts', done => { + tt.compileDirectory( + `${__dirname}/../example/typescript`, + fileName => fileName.match(/\.ts$/), + () => done(), + ); + }); +}); diff --git a/packages/addon-notes/package.json b/packages/addon-notes/package.json index 7bd7b691d61c..7d4bbd691da0 100644 --- a/packages/addon-notes/package.json +++ b/packages/addon-notes/package.json @@ -9,28 +9,27 @@ "license": "MIT", "scripts": { "prepublish": ". ./.scripts/prepublish.sh", - "test": "echo \"Error: no test specified\" && exit 0", "storybook": "start-storybook -p 9010", "publish-storybook": "bash .scripts/publish_storybook.sh" }, "devDependencies": { - "react": "^15.3.2", - "react-dom": "^15.3.2", + "@kadira/storybook": "*", + "babel-cli": "^6.5.0", "babel-core": "^6.5.0", "babel-loader": "^6.2.4", + "babel-plugin-transform-runtime": "^6.5.0", "babel-polyfill": "^6.5.0", "babel-preset-es2015": "^6.5.0", "babel-preset-react": "^6.5.0", "babel-preset-stage-2": "^6.5.0", - "babel-plugin-transform-runtime": "^6.5.0", - "babel-cli": "^6.5.0", - "react-addons-test-utils": "^15.3.2", - "@kadira/storybook": "^2.20.1", - "git-url-parse": "^6.0.1" + "git-url-parse": "^6.0.1", + "react": "^15.3.2", + "react-addons-test-utils": "^15.5.1", + "react-dom": "^15.3.2" }, "peerDependencies": { - "react": "^0.14.7 || ^15.0.0", - "@kadira/storybook-addons": "^v1.3.1" + "react": "*", + "@kadira/storybook-addons": "*" }, "dependencies": { "babel-runtime": "^6.5.0" diff --git a/packages/addon-options/package.json b/packages/addon-options/package.json index 2bcdb84997f4..80ca64cfbbec 100644 --- a/packages/addon-options/package.json +++ b/packages/addon-options/package.json @@ -4,10 +4,8 @@ "description": "Options addon for storybook", "main": "preview.js", "scripts": { - "deploy-storybook": "storybook-to-ghpages", "prepublish": "node .scripts/npm-prepublish.js", - "storybook": "start-storybook -p 9001", - "test": "echo \"Error: no test specified\" && exit 0" + "storybook": "start-storybook -p 9001" }, "repository": { "type": "git", @@ -22,21 +20,20 @@ }, "homepage": "https://github.com/kadirahq/storybook-addon-options#readme", "devDependencies": { - "@kadira/storybook": "^2.19.0", - "@kadira/storybook-addons": "^1.5.0", - "@kadira/storybook-deployer": "^1.2.0", - "@kadira/storybook-ui": "^3.5.0", - "babel-cli": "^6.14.0", - "babel-preset-es2015": "^6.14.0", - "babel-preset-react": "^6.11.1", - "babel-preset-stage-0": "^6.5.0", + "@kadira/storybook": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-ui": "*", + "babel-cli": "^6.24.1", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-0": "^6.24.1", "react": "^15.5.4", "react-dom": "^15.5.4", "react-test-renderer": "^15.5.4", - "shelljs": "^0.7.4" + "shelljs": "^0.7.7" }, "peerDependencies": { - "@kadira/storybook-addons": "^1.5.0", + "@kadira/storybook-addons": "*", "react": "*", "react-dom": "*" }, diff --git a/packages/addons/package.json b/packages/addons/package.json index 70e82e3c68bf..2212f4a35079 100644 --- a/packages/addons/package.json +++ b/packages/addons/package.json @@ -4,8 +4,7 @@ "description": "Storybook addons store", "main": "dist/index.js", "scripts": { - "prepublish": "node ./.scripts/npm-prepublish.js", - "test": "echo \"Error: no test specified\" && exit 0" + "prepublish": "node ./.scripts/npm-prepublish.js" }, "repository": { "type": "git", diff --git a/packages/channel-postmessage/package.json b/packages/channel-postmessage/package.json index 0521c2204cb0..b0928ea61d11 100644 --- a/packages/channel-postmessage/package.json +++ b/packages/channel-postmessage/package.json @@ -4,17 +4,16 @@ "description": "", "main": "dist/index.js", "scripts": { - "prepublish": "node .scripts/npm-prepublish.js", - "test": "echo \"Error: no test specified\" && exit 0" + "prepublish": "node .scripts/npm-prepublish.js" }, "license": "MIT", "devDependencies": { - "babel-cli": "^6.11.4", - "babel-preset-react-app": "^0.2.1", - "shelljs": "^0.7.3" + "babel-cli": "^6.24.1", + "babel-preset-react-app": "^2.2.0", + "shelljs": "^0.7.7" }, "dependencies": { - "@kadira/storybook-channel": "^1.1.0", + "@kadira/storybook-channel": "*", "json-stringify-safe": "^5.0.1" } } diff --git a/packages/channel-websocket/package.json b/packages/channel-websocket/package.json index 0b85a4e302c8..9c928c7a7418 100644 --- a/packages/channel-websocket/package.json +++ b/packages/channel-websocket/package.json @@ -4,8 +4,7 @@ "description": "", "main": "dist/index.js", "scripts": { - "prepublish": "node .scripts/npm-prepublish.js", - "test": "echo \"Error: no test specified\" && exit 0" + "prepublish": "node .scripts/npm-prepublish.js" }, "license": "MIT", "devDependencies": { diff --git a/packages/channel/package.json b/packages/channel/package.json index fbf5b0647ef4..bb34ba7f2767 100644 --- a/packages/channel/package.json +++ b/packages/channel/package.json @@ -4,8 +4,7 @@ "description": "", "main": "dist/index.js", "scripts": { - "prepublish": "node .scripts/npm-prepublish.js", - "test": "mocha --compilers js:babel-register src/**/__tests__/**/*.js" + "prepublish": "node .scripts/npm-prepublish.js" }, "license": "MIT", "devDependencies": { @@ -13,9 +12,6 @@ "babel-preset-es2015": "^6.9.0", "babel-preset-stage-0": "^6.5.0", "babel-register": "^6.16.3", - "chai": "^3.5.0", - "mocha": "^3.1.0", - "shelljs": "^0.7.3", - "sinon": "^1.17.6" + "shelljs": "^0.7.3" } } diff --git a/packages/channel/src/__tests__/index.js b/packages/channel/src/index.test.js similarity index 70% rename from packages/channel/src/__tests__/index.js rename to packages/channel/src/index.test.js index 245f429bbf96..8f70cee8a6ab 100644 --- a/packages/channel/src/__tests__/index.js +++ b/packages/channel/src/index.test.js @@ -1,41 +1,44 @@ -import { expect } from 'chai'; -import sinon from 'sinon'; -import Channel from '../'; +import Channel from './'; describe('Channel', () => { let transport = null; let channel = null; beforeEach(() => { - transport = { setHandler: sinon.spy(), send: sinon.spy() }; + transport = { setHandler: jest.fn(), send: jest.fn() }; channel = new Channel({ transport }); }); describe('constructor', () => { it('should set the handler', () => { - expect(transport.setHandler.calledOnce).to.equal(true); + expect(transport.setHandler).toHaveBeenCalled(); }); }); describe('method:addListener', () => { it('should call channel.on with args', () => { - channel.on = sinon.spy(); + channel.on = jest.fn(); channel.addListener(1, 2); - expect(channel.on.calledOnce).to.equal(true); - expect(channel.on.calledWith(1, 2)).to.equal(true); + expect(channel.on).toHaveBeenCalled(); + expect(channel.on).toHaveBeenCalledWith(1, 2); }); }); describe('method:emit', () => { it('should call transport.send', () => { - transport.send = sinon.spy(); - channel.emit('test-type', 1, 2, 3); - const expected = { type: 'test-type', args: [1, 2, 3] }; - expect(transport.send.calledOnce).to.equal(true); - const event = transport.send.args[0][0]; - expect(event.from).to.be.a('string'); + transport.send = jest.fn(); + const type = 'test-type'; + const args = [1, 2, 3]; + const expected = { type, args }; + + channel.emit(type, ...args); + expect(transport.send).toHaveBeenCalled(); + + const event = transport.send.mock.calls[0][0]; + expect(typeof event.from).toEqual('string'); + delete event.from; - expect(event).to.deep.equal(expected); + expect(event).toEqual(expected); }); }); @@ -45,7 +48,7 @@ describe('Channel', () => { channel.on('type-2', 21); channel.on('type-2', 22); const expected = ['type-1', 'type-2']; - expect(channel.eventNames()).to.deep.equal(expected); + expect(channel.eventNames()).toEqual(expected); }); }); @@ -54,8 +57,8 @@ describe('Channel', () => { channel.on('type-1', 11); channel.on('type-2', 21); channel.on('type-2', 22); - expect(channel.listenerCount('type-1')).to.equal(1); - expect(channel.listenerCount('type-2')).to.equal(2); + expect(channel.listenerCount('type-1')).toEqual(1); + expect(channel.listenerCount('type-2')).toEqual(2); }); }); @@ -64,8 +67,8 @@ describe('Channel', () => { channel.on('type-1', 11); channel.on('type-2', 21); channel.on('type-2', 22); - expect(channel.listeners('type-1')).to.deep.equal([11]); - expect(channel.listeners('type-2')).to.deep.equal([21, 22]); + expect(channel.listeners('type-1')).toEqual([11]); + expect(channel.listeners('type-2')).toEqual([21, 22]); }); }); @@ -78,7 +81,7 @@ describe('Channel', () => { 'type-1': [11], 'type-2': [21, 22], }; - expect(channel._listeners).to.deep.equal(expected); + expect(channel._listeners).toEqual(expected); }); it('should call event listeners on event', () => { @@ -86,7 +89,7 @@ describe('Channel', () => { channel.on('type-1', n => received.push(n)); channel._handleEvent({ type: 'type-1', args: [11] }); channel._handleEvent({ type: 'type-1', args: [12] }); - expect(received).to.deep.equal([11, 12]); + expect(received).toEqual([11, 12]); }); }); @@ -95,8 +98,8 @@ describe('Channel', () => { channel.once('type-1', 11); channel.once('type-2', 21); channel.once('type-2', 22); - expect(channel._listeners['type-1'].length).to.equal(1); - expect(channel._listeners['type-2'].length).to.equal(2); + expect(channel._listeners['type-1'].length).toEqual(1); + expect(channel._listeners['type-2'].length).toEqual(2); }); it('should call event listeners only once', () => { @@ -104,7 +107,7 @@ describe('Channel', () => { channel.once('type-1', n => received.push(n)); channel._handleEvent({ type: 'type-1', args: [11] }); channel._handleEvent({ type: 'type-1', args: [12] }); - expect(received).to.deep.equal([11]); + expect(received).toEqual([11]); }); }); @@ -117,7 +120,7 @@ describe('Channel', () => { 'type-1': [11], 'type-2': [22, 21], }; - expect(channel._listeners).to.deep.equal(expected); + expect(channel._listeners).toEqual(expected); }); }); @@ -126,8 +129,8 @@ describe('Channel', () => { channel.prependOnceListener('type-1', 11); channel.prependOnceListener('type-2', 21); channel.prependOnceListener('type-2', 22); - expect(channel._listeners['type-1'].length).to.equal(1); - expect(channel._listeners['type-2'].length).to.equal(2); + expect(channel._listeners['type-1'].length).toEqual(1); + expect(channel._listeners['type-2'].length).toEqual(2); }); it('should call event listeners only once', () => { @@ -135,7 +138,7 @@ describe('Channel', () => { channel.prependOnceListener('type-1', n => received.push(n)); channel._handleEvent({ type: 'type-1', args: [11] }); channel._handleEvent({ type: 'type-1', args: [12] }); - expect(received).to.deep.equal([11]); + expect(received).toEqual([11]); }); }); @@ -145,7 +148,7 @@ describe('Channel', () => { channel.on('type-2', 21); channel.on('type-2', 22); channel.removeAllListeners(); - expect(channel._listeners).to.deep.equal({}); + expect(channel._listeners).toEqual({}); }); it('should remove all listeners for a type', () => { @@ -153,7 +156,7 @@ describe('Channel', () => { channel.on('type-2', 21); channel.on('type-2', 22); channel.removeAllListeners('type-2'); - expect(channel._listeners).to.deep.equal({ 'type-1': [11] }); + expect(channel._listeners).toEqual({ 'type-1': [11] }); }); }); @@ -167,7 +170,7 @@ describe('Channel', () => { 'type-2': [21], }; channel.removeListener('type-2', 22); - expect(channel._listeners).to.deep.equal(expected); + expect(channel._listeners).toEqual(expected); }); }); @@ -177,7 +180,7 @@ describe('Channel', () => { channel.on('type-1', n => received.push(n)); channel._handleEvent({ type: 'type-1', args: [11] }); channel._handleEvent({ type: 'type-1', args: [12], from: channel._sender }); - expect(received).to.deep.equal([11]); + expect(received).toEqual([11]); }); }); }); diff --git a/packages/examples/cra-storybook/src/stories/index.js b/packages/examples/cra-storybook/src/stories/index.js deleted file mode 100644 index cd66c187d783..000000000000 --- a/packages/examples/cra-storybook/src/stories/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; -import Button from './Button'; -import Welcome from './Welcome'; - -storiesOf('Welcome', module) - .add('to Storybook', () => ( - - )); - -storiesOf('Button', module) - .add('with text', () => ( - - )) - .add('with some emoji', () => ( - - )); diff --git a/packages/examples/yarn.lock b/packages/examples/yarn.lock deleted file mode 100644 index a9beef1f879c..000000000000 --- a/packages/examples/yarn.lock +++ /dev/null @@ -1,732 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -ansi-align@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-1.1.0.tgz#2f0c1658829739add5ebb15e6b0c6e3423f016ba" - dependencies: - string-width "^1.0.1" - -ansi-escapes@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -balanced-match@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" - -boxen@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-0.6.0.tgz#8364d4248ac34ff0ef1b2f2bf49a6c60ce0d81b6" - dependencies: - ansi-align "^1.1.0" - camelcase "^2.1.0" - chalk "^1.1.1" - cli-boxes "^1.0.0" - filled-array "^1.0.0" - object-assign "^4.0.1" - repeating "^2.0.0" - string-width "^1.0.1" - widest-line "^1.0.0" - -brace-expansion@^1.0.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" - dependencies: - balanced-match "^0.4.1" - concat-map "0.0.1" - -buffer-shims@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" - -camelcase@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" - -capture-stack-trace@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d" - -chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -child-process-promise@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/child-process-promise/-/child-process-promise-2.2.1.tgz#4730a11ef610fad450b8f223c79d31d7bdad8074" - dependencies: - cross-spawn "^4.0.2" - node-version "^1.0.0" - promise-polyfill "^6.0.1" - -cli-boxes@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" - -cli-cursor@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" - dependencies: - restore-cursor "^1.0.1" - -cli-width@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-1.1.1.tgz#a4d293ef67ebb7b88d4a4d42c0ccf00c4d1e366d" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -commander@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" - dependencies: - graceful-readlink ">= 1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -concat-stream@^1.4.7: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" - dependencies: - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -configstore@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/configstore/-/configstore-2.1.0.tgz#737a3a7036e9886102aa6099e47bb33ab1aba1a1" - dependencies: - dot-prop "^3.0.0" - graceful-fs "^4.1.2" - mkdirp "^0.5.0" - object-assign "^4.0.1" - os-tmpdir "^1.0.0" - osenv "^0.1.0" - uuid "^2.0.1" - write-file-atomic "^1.1.2" - xdg-basedir "^2.0.0" - -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -create-error-class@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" - dependencies: - capture-stack-trace "^1.0.0" - -cross-spawn@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" - dependencies: - lru-cache "^4.0.1" - which "^1.2.9" - -deep-extend@~0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253" - -dot-prop@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" - dependencies: - is-obj "^1.0.0" - -duplexer2@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" - dependencies: - readable-stream "^2.0.2" - -error-ex@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" - dependencies: - is-arrayish "^0.2.1" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -exit-hook@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" - -figures@^1.3.5: - version "1.7.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" - dependencies: - escape-string-regexp "^1.0.5" - object-assign "^4.1.0" - -filled-array@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/filled-array/-/filled-array-1.1.0.tgz#c3c4f6c663b923459a9aa29912d2d031f1507f84" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -getstorybook@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/getstorybook/-/getstorybook-1.7.0.tgz#73c84d9a3a33d1be697c6892a4378ba61090e0e2" - dependencies: - chalk "^1.1.3" - commander "^2.9.0" - json5 "^0.5.0" - merge-dirs "^0.2.1" - shelljs "^0.7.3" - spawn-sync "^1.0.15" - update-notifier "^1.0.2" - -glob@^7.0.0, glob@^7.0.5: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - -got@^5.0.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/got/-/got-5.7.1.tgz#5f81635a61e4a6589f180569ea4e381680a51f35" - dependencies: - create-error-class "^3.0.1" - duplexer2 "^0.1.4" - is-redirect "^1.0.0" - is-retry-allowed "^1.0.0" - is-stream "^1.0.0" - lowercase-keys "^1.0.0" - node-status-codes "^1.0.0" - object-assign "^4.0.1" - parse-json "^2.1.0" - pinkie-promise "^2.0.0" - read-all-stream "^3.0.0" - readable-stream "^2.0.5" - timed-out "^3.0.0" - unzip-response "^1.0.2" - url-parse-lax "^1.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@~2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - -ini@~1.3.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" - -inquirer@^0.11.0: - version "0.11.4" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.11.4.tgz#81e3374e8361beaff2d97016206d359d0b32fa4d" - dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" - chalk "^1.0.0" - cli-cursor "^1.0.1" - cli-width "^1.0.1" - figures "^1.3.5" - lodash "^3.3.1" - readline2 "^1.0.1" - run-async "^0.1.0" - rx-lite "^3.1.2" - string-width "^1.0.1" - strip-ansi "^3.0.0" - through "^2.3.6" - -interpret@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.2.tgz#f4f623f0bb7122f15f5717c8e254b8161b5c5b2d" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -is-npm@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" - -is-obj@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" - -is-redirect@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" - -is-retry-allowed@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" - -is-stream@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -json5@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" - -latest-version@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-2.0.0.tgz#56f8d6139620847b8017f8f1f4d78e211324168b" - dependencies: - package-json "^2.0.0" - -lazy-req@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/lazy-req/-/lazy-req-1.1.0.tgz#bdaebead30f8d824039ce0ce149d4daa07ba1fac" - -lodash@^3.3.1: - version "3.10.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" - -lowercase-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306" - -lru-cache@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e" - dependencies: - pseudomap "^1.0.1" - yallist "^2.0.0" - -merge-dirs@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/merge-dirs/-/merge-dirs-0.2.1.tgz#21e648b2c6b0261712509e4df36c2424773160c9" - dependencies: - inquirer "^0.11.0" - minimist "^1.2.0" - node-fs "~0.1.7" - path "^0.12.7" - -minimatch@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" - dependencies: - brace-expansion "^1.0.0" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -mkdirp@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" - -node-fs@~0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/node-fs/-/node-fs-0.1.7.tgz#32323cccb46c9fbf0fc11812d45021cc31d325bb" - -node-status-codes@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-status-codes/-/node-status-codes-1.0.0.tgz#5ae5541d024645d32a58fcddc9ceecea7ae3ac2f" - -node-version@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-version/-/node-version-1.0.0.tgz#1b9b9584a9a7f7a6123f215cd14a652bf21ab19e" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - -object-assign@^4.0.1, object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -onetime@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -os-shim@^0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/os-shim/-/os-shim-0.1.3.tgz#6b62c3791cf7909ea35ed46e17658bb417cb3917" - -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -osenv@^0.1.0: - version "0.1.4" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -package-json@^2.0.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-2.4.0.tgz#0d15bd67d1cbbddbb2ca222ff2edb86bcb31a8bb" - dependencies: - got "^5.0.0" - registry-auth-token "^3.0.1" - registry-url "^3.0.3" - semver "^5.1.0" - -parse-json@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" - dependencies: - error-ex "^1.2.0" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - -path@^0.12.7: - version "0.12.7" - resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f" - dependencies: - process "^0.11.1" - util "^0.10.3" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -prepend-http@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" - -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - -process@^0.11.1: - version "0.11.9" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1" - -promise-polyfill@^6.0.1: - version "6.0.2" - resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-6.0.2.tgz#d9c86d3dc4dc2df9016e88946defd69b49b41162" - -pseudomap@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -rc@^1.0.1, rc@^1.1.6: - version "1.2.1" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -read-all-stream@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" - dependencies: - pinkie-promise "^2.0.0" - readable-stream "^2.0.0" - -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.2.2: - version "2.2.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" - dependencies: - buffer-shims "^1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - dependencies: - resolve "^1.1.6" - -registry-auth-token@^3.0.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.1.1.tgz#1b93317b42527732f56f88c41b73b7bf855e05a5" - dependencies: - rc "^1.1.6" - -registry-url@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" - dependencies: - rc "^1.0.1" - -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - dependencies: - is-finite "^1.0.0" - -resolve@^1.1.6: - version "1.3.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" - dependencies: - path-parse "^1.0.5" - -restore-cursor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" - dependencies: - exit-hook "^1.0.0" - onetime "^1.0.0" - -rimraf@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" - dependencies: - glob "^7.0.5" - -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" - dependencies: - once "^1.3.0" - -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" - -semver-diff@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36" - dependencies: - semver "^5.0.3" - -semver@^5.0.3, semver@^5.1.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - -shelljs@^0.7.3: - version "0.7.7" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -slide@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" - -spawn-sync@^1.0.15: - version "1.0.15" - resolved "https://registry.yarnpkg.com/spawn-sync/-/spawn-sync-1.0.15.tgz#b00799557eb7fb0c8376c29d44e8a1ea67e57476" - dependencies: - concat-stream "^1.4.7" - os-shim "^0.1.2" - -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - -timed-out@^3.0.0: - version "3.1.3" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-3.1.3.tgz#95860bfcc5c76c277f8f8326fd0f5b2e20eba217" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - -unzip-response@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-1.0.2.tgz#b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe" - -update-notifier@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-1.0.3.tgz#8f92c515482bd6831b7c93013e70f87552c7cf5a" - dependencies: - boxen "^0.6.0" - chalk "^1.0.0" - configstore "^2.0.0" - is-npm "^1.0.0" - latest-version "^2.0.0" - lazy-req "^1.1.0" - semver-diff "^2.0.0" - xdg-basedir "^2.0.0" - -url-parse-lax@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" - dependencies: - prepend-http "^1.0.1" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -util@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - dependencies: - inherits "2.0.1" - -uuid@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" - -which@^1.2.9: - version "1.2.14" - resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" - dependencies: - isexe "^2.0.0" - -widest-line@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-1.0.0.tgz#0c09c85c2a94683d0d7eaf8ee097d564bf0e105c" - dependencies: - string-width "^1.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -write-file-atomic@^1.1.2: - version "1.3.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.1.tgz#7d45ba32316328dd1ec7d90f60ebc0d845bb759a" - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - slide "^1.1.5" - -xdg-basedir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-2.0.0.tgz#edbc903cc385fc04523d966a335504b5504d1bd2" - dependencies: - os-homedir "^1.0.0" - -yallist@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" diff --git a/packages/getstorybook/bin/generate.js b/packages/getstorybook/bin/generate.js index 8d4ee4f131b0..24697a093fa5 100755 --- a/packages/getstorybook/bin/generate.js +++ b/packages/getstorybook/bin/generate.js @@ -1,7 +1,5 @@ #!/usr/bin/env node -/* eslint global-require: 0 */ - const updateNotifier = require('update-notifier'); const program = require('commander'); const chalk = require('chalk'); diff --git a/packages/getstorybook/package.json b/packages/getstorybook/package.json index 2d74ca18c067..6db47b5f7279 100644 --- a/packages/getstorybook/package.json +++ b/packages/getstorybook/package.json @@ -5,9 +5,6 @@ "bin": { "getstorybook": "./bin/generate.js" }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 0" - }, "repository": { "type": "git", "url": "git+https://github.com/kadirahq/getstorybook.git" @@ -25,10 +22,10 @@ "dependencies": { "chalk": "^1.1.3", "commander": "^2.9.0", - "json5": "^0.5.0", + "json5": "^0.5.1", "merge-dirs": "^0.2.1", - "shelljs": "^0.7.3", + "shelljs": "^0.7.7", "spawn-sync": "^1.0.15", - "update-notifier": "^1.0.2" + "update-notifier": "^2.1.0" } } diff --git a/packages/react-native-storybook/package.json b/packages/react-native-storybook/package.json index 8c5181d165bc..de9c4225503e 100644 --- a/packages/react-native-storybook/package.json +++ b/packages/react-native-storybook/package.json @@ -7,9 +7,7 @@ "storybook": "dist/bin/storybook.js" }, "scripts": { - "prepublish": ".scripts/npm-prepublish.sh", - "test": "echo \"Error: no test specified\" && exit 0", - "postpublish": "greenkeeper-postpublish" + "prepublish": ".scripts/npm-prepublish.sh" }, "repository": { "type": "git", @@ -30,49 +28,48 @@ "react-native": "0.27.0 - 0.43.x" }, "devDependencies": { - "babel-cli": "^6.11.4", - "greenkeeper-postpublish": "^1.0.1", + "babel-cli": "^6.24.1", "react": "^15.5.4", "react-dom": "^15.5.4", - "react-native": "^0.39.0" + "react-native": "^0.43.3" }, "dependencies": { - "@kadira/storybook-addon-actions": "^1.0.4", - "@kadira/storybook-addon-links": "^1.0.1", - "@kadira/storybook-addons": "^1.4.0", - "@kadira/storybook-channel-websocket": "^1.0.1", - "@kadira/storybook-ui": "^3.3.1", - "autoprefixer": "^6.4.0", - "babel-core": "^6.13.2", - "babel-loader": "^6.2.5", + "@kadira/storybook-addon-actions": "*", + "@kadira/storybook-addon-links": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-channel-websocket": "*", + "@kadira/storybook-ui": "*", + "autoprefixer": "^6.7.7", + "babel-core": "^6.24.1", + "babel-loader": "^6.4.1", "babel-plugin-syntax-async-functions": "^6.13.0", - "babel-plugin-syntax-trailing-function-commas": "^6.13.0", - "babel-plugin-transform-class-properties": "^6.11.5", - "babel-plugin-transform-object-rest-spread": "^6.8.0", - "babel-plugin-transform-react-constant-elements": "^6.9.1", - "babel-plugin-transform-regenerator": "^6.11.4", - "babel-plugin-transform-runtime": "^6.12.0", - "babel-polyfill": "^6.13.0", - "babel-preset-es2015": "^6.13.2", - "babel-preset-es2016": "^6.11.3", - "babel-preset-react": "^6.11.1", - "babel-preset-stage-0": "^6.5.0", - "babel-runtime": "^6.11.6", - "case-sensitive-paths-webpack-plugin": "^1.1.3", + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-plugin-transform-react-constant-elements": "^6.23.0", + "babel-plugin-transform-regenerator": "^6.24.1", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-polyfill": "^6.23.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-es2016": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-0": "^6.24.1", + "babel-runtime": "^6.23.0", + "case-sensitive-paths-webpack-plugin": "^2.0.0", "commander": "^2.9.0", - "css-loader": "^0.25.0", + "css-loader": "^0.28.0", "events": "^1.1.1", - "express": "^4.14.0", - "file-loader": "^0.9.0", + "express": "^4.15.2", + "file-loader": "^0.11.1", "json-loader": "^0.5.4", - "json5": "^0.5.0", - "postcss-loader": "^0.13.0", - "shelljs": "^0.7.3", - "style-loader": "^0.13.1", - "url-loader": "^0.5.7", + "json5": "^0.5.1", + "postcss-loader": "^1.3.3", + "shelljs": "^0.7.7", + "style-loader": "^0.16.1", + "url-loader": "^0.5.8", "uuid": "^3.0.1", - "webpack": "^1.13.2", - "webpack-dev-middleware": "^1.8.3", - "webpack-hot-middleware": "^2.12.2" + "webpack": "^2.4.1", + "webpack-dev-middleware": "^1.10.1", + "webpack-hot-middleware": "^2.18.0" } } diff --git a/packages/react-storybook/package.json b/packages/react-storybook/package.json index 8a6b03d7af79..152c36b2d022 100644 --- a/packages/react-storybook/package.json +++ b/packages/react-storybook/package.json @@ -8,51 +8,45 @@ }, "typings": "./config/storybook.d.ts", "license": "MIT", - "options": { - "mocha": "--require scripts/mocha_runner src/**/__tests__/**/*.js" - }, "scripts": { "prepublish": "sh scripts/prepublish.sh", - "test": "mocha $npm_package_options_mocha", - "test-watch": "npm run testonly -- --watch --watch-extensions js", - "dev": "DEV_BUILD=1 nodemon --watch ./src --exec 'npm run prepublish'", - "postpublish": "greenkeeper-postpublish" + "dev": "DEV_BUILD=1 nodemon --watch ./src --exec 'npm run prepublish'" }, "dependencies": { "@kadira/react-split-pane": "^1.4.7", - "@kadira/storybook-addon-actions": "^1.1.3", - "@kadira/storybook-addon-links": "^1.0.1", - "@kadira/storybook-addons": "^1.6.1", - "@kadira/storybook-channel-postmsg": "^2.0.1", - "@kadira/storybook-ui": "^3.11.0", + "@kadira/storybook-addon-actions": "*", + "@kadira/storybook-addon-links": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-channel-postmsg": "*", + "@kadira/storybook-ui": "*", "airbnb-js-shims": "^1.1.1", "autoprefixer": "^6.7.7", - "babel-core": "^6.24.0", + "babel-core": "^6.24.1", "babel-loader": "^6.4.1", "babel-plugin-react-docgen": "^1.4.2", - "babel-preset-es2015": "^6.24.0", - "babel-preset-es2016": "^6.22.0", - "babel-preset-react": "^6.23.0", - "babel-preset-stage-0": "^6.22.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-es2016": "^6.24.1", + "babel-preset-react": "^6.24.1", "babel-preset-react-app": "^2.2.0", + "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.23.0", - "case-sensitive-paths-webpack-plugin": "^1.1.4", + "case-sensitive-paths-webpack-plugin": "^2.0.0", "chalk": "^1.1.3", "commander": "^2.9.0", "common-tags": "^1.4.0", "configstore": "^3.0.0", "css-loader": "^0.28.0", "express": "^4.15.2", - "file-loader": "^0.11.0", + "file-loader": "^0.11.1", "find-cache-dir": "^0.1.1", "json-loader": "^0.5.4", "json-stringify-safe": "^5.0.1", "json5": "^0.5.1", "lodash.pick": "^4.4.0", "postcss-loader": "1.3.3", - "prop-types": "^15.5.7", + "prop-types": "^15.5.8", "qs": "^6.4.0", - "react-modal": "^1.7.3", + "react-modal": "^1.7.6", "redux": "^3.6.0", "request": "^2.81.0", "serve-favicon": "^2.4.2", @@ -60,30 +54,20 @@ "style-loader": "0.16.1", "url-loader": "^0.5.8", "uuid": "^3.0.1", - "webpack": "^2.3.2", + "webpack": "^2.4.1", "webpack-dev-middleware": "^1.10.1", - "webpack-hot-middleware": "^2.17.1" + "webpack-hot-middleware": "^2.18.0" }, "peerDependencies": { "react": "*", "react-dom": "*" }, "devDependencies": { - "babel-cli": "^6.24.0", - "babel-eslint": "^7.2.1", - "chai": "^3.5.0", - "deep-equal": "^1.0.1", - "enzyme": "^2.8.0", - "expect": "^1.20.2", - "greenkeeper-postpublish": "^1.0.1", - "jsdom": "^9.12.0", - "mocha": "^3.2.0", + "babel-cli": "^6.24.1", "mock-fs": "^4.2.0", "nodemon": "^1.11.0", "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-test-renderer": "^15.5.4", - "sinon": "^2.1.0" + "react-dom": "^15.5.4" }, "main": "dist/client/index.js", "bin": { diff --git a/packages/react-storybook/src/client/manager/preview.js b/packages/react-storybook/src/client/manager/preview.js index 208ddf109aa2..899979141ad4 100644 --- a/packages/react-storybook/src/client/manager/preview.js +++ b/packages/react-storybook/src/client/manager/preview.js @@ -10,7 +10,6 @@ const iframeStyle = { }; class Preview extends Component { - /* eslint-disable class-methods-use-this */ shouldComponentUpdate() { // When the manager is re-rendered, due to changes in the layout (going full screen / changing // addon panel to right) Preview section will update. If its re-rendered the whole html page @@ -19,7 +18,6 @@ class Preview extends Component { // story using the channel and necessary changes are done by it. return false; } - /* eslint-enable class-methods-use-this */ render() { return ( diff --git a/packages/react-storybook/src/client/manager/provider.js b/packages/react-storybook/src/client/manager/provider.js index 3a9756892097..d690fb02a472 100644 --- a/packages/react-storybook/src/client/manager/provider.js +++ b/packages/react-storybook/src/client/manager/provider.js @@ -1,5 +1,4 @@ /* global location */ -/* eslint class-methods-use-this: 0 */ import qs from 'qs'; import React from 'react'; diff --git a/packages/react-storybook/src/client/preview/__tests__/client_api.js b/packages/react-storybook/src/client/preview/client_api.test.js similarity index 88% rename from packages/react-storybook/src/client/preview/__tests__/client_api.js rename to packages/react-storybook/src/client/preview/client_api.test.js index e0d7ff8278eb..56f1c7783d37 100644 --- a/packages/react-storybook/src/client/preview/__tests__/client_api.js +++ b/packages/react-storybook/src/client/preview/client_api.test.js @@ -1,7 +1,4 @@ -import { expect } from 'chai'; -import ClientAPI from '../client_api'; - -const { describe, it } = global; +import ClientAPI from './client_api'; class StoryStore { constructor() { @@ -57,7 +54,7 @@ describe('preview.client_api', () => { }); api.storiesOf('none').aa(); - expect(data).to.be.equal('foo'); + expect(data).toBe('foo'); }); it('should not remove previous addons', () => { @@ -77,7 +74,7 @@ describe('preview.client_api', () => { }); api.storiesOf('none').aa().bb(); - expect(data).to.deep.equal(['foo', 'bar']); + expect(data).toEqual(['foo', 'bar']); }); it('should call with the api context', () => { @@ -91,7 +88,7 @@ describe('preview.client_api', () => { }); api.storiesOf('none').aa(); - expect(data).to.be.equal('function'); + expect(data).toBe('function'); }); it('should be able to access addons added previously', () => { @@ -111,7 +108,7 @@ describe('preview.client_api', () => { }); api.storiesOf('none').bb(); - expect(data).to.be.equal('foo'); + expect(data).toBe('foo'); }); it('should be able to access the current kind', () => { @@ -126,7 +123,7 @@ describe('preview.client_api', () => { }); api.storiesOf(kind).aa(); - expect(data).to.be.equal(kind); + expect(data).toBe(kind); }); }); @@ -138,7 +135,7 @@ describe('preview.client_api', () => { localApi.addDecorator(fn => `aa-${fn()}`); localApi.add('storyName', () => 'Hello'); - expect(storyStore.stories[0].fn()).to.be.equal('aa-Hello'); + expect(storyStore.stories[0].fn()).toBe('aa-Hello'); }); it('should add global decorators', () => { @@ -148,7 +145,7 @@ describe('preview.client_api', () => { const localApi = api.storiesOf('none'); localApi.add('storyName', () => 'Hello'); - expect(storyStore.stories[0].fn()).to.be.equal('bb-Hello'); + expect(storyStore.stories[0].fn()).toBe('bb-Hello'); }); it('should utilize both decorators at once', () => { @@ -160,7 +157,7 @@ describe('preview.client_api', () => { localApi.addDecorator(fn => `bb-${fn()}`); localApi.add('storyName', () => 'Hello'); - expect(storyStore.stories[0].fn()).to.be.equal('aa-bb-Hello'); + expect(storyStore.stories[0].fn()).toBe('aa-bb-Hello'); }); it('should pass the context', () => { @@ -175,7 +172,7 @@ describe('preview.client_api', () => { const story = 'ef349ff'; const result = storyStore.stories[0].fn({ kind, story }); - expect(result).to.be.equal(`aa-${kind}-${story}`); + expect(result).toBe(`aa-${kind}-${story}`); }); it('should have access to the context', () => { @@ -190,7 +187,7 @@ describe('preview.client_api', () => { const story = 'ef349ff'; const result = storyStore.stories[0].fn({ kind, story }); - expect(result).to.be.equal(`${kind}-${story}-Hello`); + expect(result).toBe(`${kind}-${story}-Hello`); }); }); @@ -199,7 +196,7 @@ describe('preview.client_api', () => { const api = new ClientAPI({}); api._globalDecorators = 1234; api.clearDecorators(); - expect(api._globalDecorators).to.deep.equal([]); + expect(api._globalDecorators).toEqual([]); }); }); @@ -208,7 +205,7 @@ describe('preview.client_api', () => { const storyStore = new StoryStore(); const api = new ClientAPI({ storyStore }); const book = api.getStorybook(); - expect(book).to.deep.equal([]); + expect(book).toEqual([]); }); it('should return storybook with stories', () => { @@ -227,7 +224,7 @@ describe('preview.client_api', () => { kind2.add('story-2.1', functions['story-2.1']); kind2.add('story-2.2', functions['story-2.2']); const book = api.getStorybook(); - expect(book).to.deep.equal([ + expect(book).toEqual([ { kind: 'kind-1', stories: [ diff --git a/packages/react-storybook/src/client/preview/render.js b/packages/react-storybook/src/client/preview/render.js index 655615635525..acd5c7a5a277 100644 --- a/packages/react-storybook/src/client/preview/render.js +++ b/packages/react-storybook/src/client/preview/render.js @@ -75,12 +75,10 @@ export function renderMain(data, storyStore) { if (!element) { const error = { title: `Expecting a React element from the story: "${selectedStory}" of "${selectedKind}".`, - /* eslint-disable */ description: stripIndents` Did you forget to return the React element from the story? Use "() => ()" or "() => { return ; }" when defining the story. `, - /* eslint-enable */ }; return renderError(error); } diff --git a/packages/react-storybook/src/server/babel_config.js b/packages/react-storybook/src/server/babel_config.js index a49ef43975d0..7ed0bc5ca030 100644 --- a/packages/react-storybook/src/server/babel_config.js +++ b/packages/react-storybook/src/server/babel_config.js @@ -1,9 +1,8 @@ -/* eslint global-require: 0 */ - import fs from 'fs'; import path from 'path'; import JSON5 from 'json5'; import defaultConfig from './config/babel'; + // avoid ESLint errors const logger = console; diff --git a/packages/react-storybook/src/server/config.js b/packages/react-storybook/src/server/config.js index 964cb9b1c7e5..362abe070876 100644 --- a/packages/react-storybook/src/server/config.js +++ b/packages/react-storybook/src/server/config.js @@ -1,5 +1,3 @@ -/* eslint global-require: 0 */ - import fs from 'fs'; import path from 'path'; import loadBabelConfig from './babel_config'; @@ -44,7 +42,6 @@ export default function(configType, baseConfig, configDir) { customConfigPath = path.resolve(__dirname, './config/defaults/webpack.config.js'); } - // eslint-disable-next-line const customConfig = require(customConfigPath); if (typeof customConfig === 'function') { diff --git a/packages/react-storybook/src/server/track_usage.js b/packages/react-storybook/src/server/track_usage.js index cec6d02a9169..835d62e152c4 100644 --- a/packages/react-storybook/src/server/track_usage.js +++ b/packages/react-storybook/src/server/track_usage.js @@ -1,5 +1,3 @@ -/* eslint global-require: 0 */ - // ### WHAT? // // We will track anonymous usage of how you use storybook. diff --git a/packages/react-storybook/src/server/utils.js b/packages/react-storybook/src/server/utils.js index 0b59e47a4890..19811869d4fd 100644 --- a/packages/react-storybook/src/server/utils.js +++ b/packages/react-storybook/src/server/utils.js @@ -20,7 +20,7 @@ export function getEnvConfig(program, configEnv) { const envVarName = configEnv[fieldName]; const envVarValue = process.env[envVarName]; if (envVarValue) { - program[fieldName] = envVarValue; // eslint-disable-line no-param-reassign + program[fieldName] = envVarValue; } }); } @@ -28,7 +28,6 @@ export function getEnvConfig(program, configEnv) { export function getMiddleware(configDir) { const middlewarePath = path.resolve(configDir, 'middleware.js'); if (fs.existsSync(middlewarePath)) { - // eslint-disable-next-line let middlewareModule = require(middlewarePath); if (middlewareModule.__esModule) { middlewareModule = middlewareModule.default; @@ -36,5 +35,4 @@ export function getMiddleware(configDir) { return middlewareModule; } return function() {}; - /* eslint-enable */ } diff --git a/packages/react-storybook/src/server/__tests__/utils.js b/packages/react-storybook/src/server/utils.test.js similarity index 78% rename from packages/react-storybook/src/server/__tests__/utils.js rename to packages/react-storybook/src/server/utils.test.js index f7eb52794e22..52f0cfa1d26c 100644 --- a/packages/react-storybook/src/server/__tests__/utils.js +++ b/packages/react-storybook/src/server/utils.test.js @@ -1,8 +1,5 @@ -import { expect } from 'chai'; import mock from 'mock-fs'; -import { getHeadHtml } from '../utils'; - -const { describe, it, beforeEach, afterEach } = global; +import { getHeadHtml } from './utils'; const HEAD_HTML_CONTENTS = ''; @@ -20,7 +17,7 @@ describe('server.getHeadHtml', () => { it('return an empty string', () => { const result = getHeadHtml('./config'); - expect(result).to.be.equal(''); + expect(result).toEqual(''); }); }); @@ -39,7 +36,7 @@ describe('server.getHeadHtml', () => { it('return the contents of the file', () => { const result = getHeadHtml('./config'); - expect(result).to.be.equal(HEAD_HTML_CONTENTS); + expect(result).toEqual(HEAD_HTML_CONTENTS); }); }); }); diff --git a/packages/storybook-ui/.scripts/mocha_runner.js b/packages/storybook-ui/.scripts/mocha_runner.js deleted file mode 100644 index 5f4425bfe691..000000000000 --- a/packages/storybook-ui/.scripts/mocha_runner.js +++ /dev/null @@ -1,31 +0,0 @@ -// IMPORTANT -// --------- -// This is an auto generated file with React CDK. -// Do not modify this file. -// Use `.scripts/user/pretest.js instead`. - -require('babel-core/register'); -require('babel-polyfill'); - -// Add jsdom support, which is required for enzyme. -var jsdom = require('jsdom').jsdom; - -var exposedProperties = ['window', 'navigator', 'document']; - -global.document = jsdom(''); -global.window = document.defaultView; -Object.keys(document.defaultView).forEach((property) => { - if (typeof global[property] === 'undefined') { - exposedProperties.push(property); - global[property] = document.defaultView[property]; - } -}); - -global.navigator = { - userAgent: 'node.js' -}; - -process.on('unhandledRejection', function (error) { - console.error('Unhandled Promise Rejection:'); - console.error(error && error.stack || error); -}); diff --git a/packages/storybook-ui/example/package.json b/packages/storybook-ui/example/package.json index 6f9224715c5c..bd44ab791365 100644 --- a/packages/storybook-ui/example/package.json +++ b/packages/storybook-ui/example/package.json @@ -3,9 +3,6 @@ "version": "1.0.0", "description": "", "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, "author": "", "license": "ISC", "devDependencies": { diff --git a/packages/storybook-ui/package.json b/packages/storybook-ui/package.json index b93e39c1a421..d7ac3ed36b5c 100644 --- a/packages/storybook-ui/package.json +++ b/packages/storybook-ui/package.json @@ -9,29 +9,21 @@ "license": "MIT", "scripts": { "prepublish": ". ./.scripts/prepublish.sh", - "test": "mocha --require ./.scripts/mocha_runner ./src/**/__tests__/**/*.js", - "test-watch": "npm run testonly -- --watch --watch-extensions js", "storybook": "start-storybook -p 9010", "publish-storybook": "bash ./.scripts/publish_storybook.sh" }, "devDependencies": { - "@kadira/storybook": "^2.35.3", - "babel-cli": "^6.24.0", - "babel-core": "^6.24.0", - "babel-eslint": "^7.2.1", + "@kadira/storybook": "*", + "babel-cli": "^6.24.1", + "babel-core": "^6.24.1", + "babel-eslint": "^7.2.2", "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.23.0", - "babel-preset-es2015": "^6.24.0", - "babel-preset-react": "^6.23.0", - "babel-preset-stage-0": "^6.22.0", - "chai": "^3.5.0", - "enzyme": "^2.8.0", - "jsdom": "^9.12.0", - "mocha": "^3.2.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-0": "^6.24.1", "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-test-renderer": "^15.5.4", - "sinon": "^2.1.0" + "react-dom": "^15.5.4" }, "peerDependencies": { "react": "*", @@ -49,12 +41,12 @@ "lodash.sortby": "^4.7.0", "mantra-core": "^1.7.0", "podda": "^1.2.2", - "prop-types": "^15.5.7", + "prop-types": "^15.5.8", "qs": "^6.4.0", "react-fuzzy": "^0.3.3", "react-inspector": "^1.1.2", "react-komposer": "^2.0.0", - "react-modal": "^1.7.3", + "react-modal": "^1.7.6", "redux": "^3.6.0" }, "main": "dist/index.js" diff --git a/packages/storybook-ui/src/__tests__/index.js b/packages/storybook-ui/src/__tests__/index.js index d6cce35115d4..e1cdb5383e47 100644 --- a/packages/storybook-ui/src/__tests__/index.js +++ b/packages/storybook-ui/src/__tests__/index.js @@ -1,6 +1,4 @@ import renderStorybookUI from '../'; -import { expect } from 'chai'; -const { describe, it } = global; describe('Main API', () => { describe('default export', () => { @@ -10,7 +8,7 @@ describe('Main API', () => { renderStorybookUI(null, fakeProvider); }; - expect(run).to.throw(/base Provider/); + expect(run).toThrow(/base Provider/); }); }); }); diff --git a/packages/storybook-ui/src/index.js b/packages/storybook-ui/src/index.js index 360135418416..d340875523d6 100644 --- a/packages/storybook-ui/src/index.js +++ b/packages/storybook-ui/src/index.js @@ -9,12 +9,10 @@ import { setContext, setActions } from './compose'; export class Provider { renderPreview(selectedKind, selectedStory) { - // eslint-disable-line no-unused-vars throw new Error('Provider.renderPreview() is not implemented!'); } handleAPI(api) { - // eslint-disable-line no-unused-vars throw new Error('Provider.handleAPI() is not implemented!'); } } diff --git a/packages/storybook-ui/src/modules/api/actions/__tests__/api.js b/packages/storybook-ui/src/modules/api/actions/api.test.js similarity index 90% rename from packages/storybook-ui/src/modules/api/actions/__tests__/api.js rename to packages/storybook-ui/src/modules/api/actions/api.test.js index be00d0ca3efc..04a04f87d769 100755 --- a/packages/storybook-ui/src/modules/api/actions/__tests__/api.js +++ b/packages/storybook-ui/src/modules/api/actions/api.test.js @@ -1,6 +1,4 @@ -import actions from '../api'; -import { expect } from 'chai'; -const { describe, it } = global; +import actions from './api'; class MockClientStore { update(cb) { @@ -21,7 +19,7 @@ describe('manager.api.actions.api', () => { actions.setStories({ clientStore }, stories); const newState = clientStore.updateCallback({}); - expect(newState).to.deep.equal({ + expect(newState).toEqual({ stories, selectedKind: 'abc', selectedStory: 'a', @@ -39,7 +37,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'c', }; const newState = clientStore.updateCallback(state); - expect(newState).to.deep.equal({ + expect(newState).toEqual({ stories, selectedKind: 'abc', selectedStory: 'c', @@ -57,7 +55,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'k', }; const newState = clientStore.updateCallback(state); - expect(newState).to.deep.equal({ + expect(newState).toEqual({ stories, selectedKind: 'bbc', selectedStory: 'x', @@ -75,7 +73,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'c', }; const newState = clientStore.updateCallback(state); - expect(newState).to.deep.equal({ + expect(newState).toEqual({ stories, selectedKind: 'abc', selectedStory: 'a', @@ -96,7 +94,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'c', }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ selectedKind: 'bbc', selectedStory: 'y', }); @@ -114,7 +112,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'c', }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ selectedKind: 'bbc', selectedStory: 'x', }); @@ -134,7 +132,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'c', }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ selectedKind: 'bbc', selectedStory: 'x', }); @@ -150,7 +148,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'c', }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ selectedKind: 'abc', selectedStory: 'b', }); @@ -168,7 +166,7 @@ describe('manager.api.actions.api', () => { selectedStory: 'z', }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ selectedKind: 'bbc', selectedStory: 'z', }); @@ -186,7 +184,7 @@ describe('manager.api.actions.api', () => { }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ uiOptions: { bbc: 50, abc: 10 }, }); }); @@ -200,7 +198,7 @@ describe('manager.api.actions.api', () => { }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ uiOptions: { bbc: 50, abc: 10 }, }); }); @@ -216,7 +214,7 @@ describe('manager.api.actions.api', () => { }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ customQueryParams: { bbc: 'bbb', abc: 'aaa', cnn: 'ccc' }, }); }); @@ -230,7 +228,7 @@ describe('manager.api.actions.api', () => { }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ customQueryParams: { bbc: 'ccc' }, }); }); diff --git a/packages/storybook-ui/src/modules/api/configs/__tests__/init_api.js b/packages/storybook-ui/src/modules/api/configs/init_api.test.js similarity index 69% rename from packages/storybook-ui/src/modules/api/configs/__tests__/init_api.js rename to packages/storybook-ui/src/modules/api/configs/init_api.test.js index 0104d3970808..43586b3d2fbc 100644 --- a/packages/storybook-ui/src/modules/api/configs/__tests__/init_api.js +++ b/packages/storybook-ui/src/modules/api/configs/init_api.test.js @@ -1,32 +1,29 @@ -import initApi from '../init_api'; -import { expect } from 'chai'; -const { describe, it } = global; -import sinon from 'sinon'; +import initApi from './init_api'; describe('manager.api.config.initApi', () => { it('should expose correct API methods', done => { const actions = { api: { - setStories: sinon.stub(), - selectStory: sinon.stub(), - setQueryParams: sinon.stub(), + setStories: jest.fn(), + selectStory: jest.fn(), + setQueryParams: jest.fn(), }, shortcuts: { - handleEvent: sinon.stub(), + handleEvent: jest.fn(), }, }; const clientStore = { - subscribe: sinon.stub(), + subscribe: jest.fn(), }; const provider = { handleAPI(api) { - expect(api.setStories).to.be.equal(actions.api.setStories); - expect(api.selectStory).to.be.equal(actions.api.selectStory); - expect(api.handleShortcut).to.be.equal(actions.shortcuts.handleEvent); - expect(typeof api.onStory).to.be.equal('function'); - expect(typeof api.setQueryParams).to.be.equal('function'); + expect(api.setStories).toBe(actions.api.setStories); + expect(api.selectStory).toBe(actions.api.selectStory); + expect(api.handleShortcut).toBe(actions.shortcuts.handleEvent); + expect(typeof api.onStory).toBe('function'); + expect(typeof api.setQueryParams).toBe('function'); done(); }, }; @@ -40,7 +37,7 @@ describe('manager.api.config.initApi', () => { const selectedStory = 'u8sd'; const clientStore = { - subscribe: sinon.stub(), + subscribe: jest.fn(), getAll: () => ({ selectedKind, selectedStory, @@ -50,8 +47,8 @@ describe('manager.api.config.initApi', () => { const provider = { handleAPI(api) { api.onStory((kind, story) => { - expect(kind).to.be.equal(selectedKind); - expect(story).to.be.equal(selectedStory); + expect(kind).toBe(selectedKind); + expect(story).toBe(selectedStory); done(); }); }, @@ -59,7 +56,7 @@ describe('manager.api.config.initApi', () => { initApi(provider, clientStore, actions); // calling the subscription - clientStore.subscribe.args[0][0](); + clientStore.subscribe.mock.calls[0][0](); }); it('should support to add multiple onStory callback', done => { @@ -68,7 +65,7 @@ describe('manager.api.config.initApi', () => { const selectedStory = 'u8sd'; const clientStore = { - subscribe: sinon.stub(), + subscribe: jest.fn(), getAll: () => ({ selectedKind, selectedStory, @@ -84,7 +81,7 @@ describe('manager.api.config.initApi', () => { api.onStory(() => { cnt++; - expect(cnt).to.be.equal(2); + expect(cnt).toBe(2); done(); }); }, @@ -92,7 +89,7 @@ describe('manager.api.config.initApi', () => { initApi(provider, clientStore, actions); // calling the subscription - clientStore.subscribe.args[0][0](); + clientStore.subscribe.mock.calls[0][0](); }); it('should support a way to remove onStory callback', done => { @@ -101,7 +98,7 @@ describe('manager.api.config.initApi', () => { const selectedStory = 'u8sd'; const clientStore = { - subscribe: sinon.stub(), + subscribe: jest.fn(), getAll: () => ({ selectedKind, selectedStory, @@ -118,7 +115,7 @@ describe('manager.api.config.initApi', () => { api.onStory(() => { cnt++; - expect(cnt).to.be.equal(1); + expect(cnt).toBe(1); done(); }); }, @@ -126,7 +123,7 @@ describe('manager.api.config.initApi', () => { initApi(provider, clientStore, actions); // calling the subscription - clientStore.subscribe.args[0][0](); + clientStore.subscribe.mock.calls[0][0](); }); describe('getQueryParam', () => { @@ -134,7 +131,7 @@ describe('manager.api.config.initApi', () => { const actions = { api: {}, shortcuts: {} }; const clientStore = { - subscribe: sinon.stub(), + subscribe: jest.fn(), getAll: () => ({ customQueryParams: { foo: 'foo value', @@ -146,7 +143,7 @@ describe('manager.api.config.initApi', () => { const provider = { handleAPI(api) { const value = api.getQueryParam('foo'); - expect(value).to.be.equal('foo value'); + expect(value).toBe('foo value'); done(); }, }; diff --git a/packages/storybook-ui/src/modules/shortcuts/actions/__tests__/shortcuts.js b/packages/storybook-ui/src/modules/shortcuts/actions/shortcuts.test.js similarity index 73% rename from packages/storybook-ui/src/modules/shortcuts/actions/__tests__/shortcuts.js rename to packages/storybook-ui/src/modules/shortcuts/actions/shortcuts.test.js index d2f567c235b8..7256d3991a86 100644 --- a/packages/storybook-ui/src/modules/shortcuts/actions/__tests__/shortcuts.js +++ b/packages/storybook-ui/src/modules/shortcuts/actions/shortcuts.test.js @@ -1,6 +1,4 @@ -import actions from '../shortcuts'; -import { expect } from 'chai'; -const { describe, it } = global; +import actions from './shortcuts'; class MockClientStore { update(cb) { @@ -10,7 +8,7 @@ class MockClientStore { describe('manager.shortcuts.actions.shortcuts', () => { describe('setOptions', () => { - it('should update options', () => { + test('should update options', () => { const clientStore = new MockClientStore(); actions.setOptions({ clientStore }, { abc: 10 }); @@ -19,12 +17,12 @@ describe('manager.shortcuts.actions.shortcuts', () => { }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ shortcutOptions: { bbc: 50, abc: 10 }, }); }); - it('should only update options for the key already defined', () => { + test('should only update options for the key already defined', () => { const clientStore = new MockClientStore(); actions.setOptions({ clientStore }, { abc: 10, kki: 50 }); @@ -33,7 +31,7 @@ describe('manager.shortcuts.actions.shortcuts', () => { }; const stateUpdates = clientStore.updateCallback(state); - expect(stateUpdates).to.deep.equal({ + expect(stateUpdates).toEqual({ shortcutOptions: { bbc: 50, abc: 10 }, }); }); diff --git a/packages/storybook-ui/src/modules/ui/actions/__tests__/ui.js b/packages/storybook-ui/src/modules/ui/actions/ui.test.js similarity index 57% rename from packages/storybook-ui/src/modules/ui/actions/__tests__/ui.js rename to packages/storybook-ui/src/modules/ui/actions/ui.test.js index a21535926fc8..5589679d223c 100755 --- a/packages/storybook-ui/src/modules/ui/actions/__tests__/ui.js +++ b/packages/storybook-ui/src/modules/ui/actions/ui.test.js @@ -1,44 +1,38 @@ -import actions from '../ui'; -import { expect } from 'chai'; -import sinon from 'sinon'; -const { describe, it } = global; +import actions from './ui'; describe('manager.ui.actions.ui', () => { describe('setStoryFilter', () => { it('should set the given filter', () => { const clientStore = { - set: sinon.stub(), + set: jest.fn(), }; const filter = 'kkkind'; - actions.setStoryFilter({ clientStore }, filter); - const args = clientStore.set.args[0]; - expect(args).to.deep.equal(['storyFilter', filter]); + + expect(clientStore.set).toHaveBeenCalledWith('storyFilter', filter); }); }); describe('toggleShortcutsHelp', () => { it('should toggle the client sotre accordingly', () => { const clientStore = { - toggle: sinon.stub(), + toggle: jest.fn(), }; - actions.toggleShortcutsHelp({ clientStore }); - const args = clientStore.toggle.args[0]; - expect(args).to.deep.equal(['showShortcutsHelp']); + + expect(clientStore.toggle).toHaveBeenCalledWith('showShortcutsHelp'); }); }); describe('selectDownPanel', () => { it('should set the given panel name', () => { const clientStore = { - set: sinon.stub(), + set: jest.fn(), }; const panelName = 'kkkind'; - actions.selectDownPanel({ clientStore }, panelName); - const args = clientStore.set.args[0]; - expect(args).to.deep.equal(['selectedDownPanel', panelName]); + + expect(clientStore.set).toHaveBeenCalledWith('selectedDownPanel', panelName); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/components/down_panel/__tests__/index.js b/packages/storybook-ui/src/modules/ui/components/down_panel/index.test.js similarity index 58% rename from packages/storybook-ui/src/modules/ui/components/down_panel/__tests__/index.js rename to packages/storybook-ui/src/modules/ui/components/down_panel/index.test.js index fe8bacc6e8ca..80a3dc67164e 100644 --- a/packages/storybook-ui/src/modules/ui/components/down_panel/__tests__/index.js +++ b/packages/storybook-ui/src/modules/ui/components/down_panel/index.test.js @@ -1,12 +1,9 @@ -const { describe, it } = global; import React from 'react'; import { shallow } from 'enzyme'; -import DownPanel from '../index'; -import { expect } from 'chai'; -import sinon from 'sinon'; +import DownPanel from './index'; describe('manager.ui.components.down_panel.index', () => { - it('should render only the selected panel with display set other than "none"', () => { + test('should render only the selected panel with display set other than "none"', () => { const panels = { test1: { render() { @@ -26,11 +23,11 @@ describe('manager.ui.components.down_panel.index', () => { , ); - expect(wrapper.find('#test1').parent().props().style.display).to.equal('none'); - expect(wrapper.find('#test2').parent().props().style.display).to.not.equal('none'); + expect(wrapper.find('#test1').parent()).toHaveStyle('display', 'none'); + expect(wrapper.find('#test2').parent()).not.toHaveStyle('display', 'none'); }); - it('should set onPanelSelected as onClick handlers of tabs', () => { + test('should set onPanelSelected as onClick handlers of tabs', () => { const panels = { test1: { render() { @@ -38,28 +35,24 @@ describe('manager.ui.components.down_panel.index', () => { }, }, }; - - const onPanelSelect = sinon.spy(); - const preventDefault = sinon.spy(); - + const onPanelSelect = jest.fn(); + const preventDefault = jest.fn(); const wrapper = shallow( , ); - wrapper.find('a').simulate('click', { preventDefault }); - expect(onPanelSelect.calledOnce).to.equal(true); - expect(preventDefault.calledOnce).to.equal(true); + + expect(onPanelSelect).toHaveBeenCalled(); + expect(preventDefault).toHaveBeenCalled(); }); describe('when no panels are given', () => { - it('should render "no panels available"', () => { + test('should render "no panels available"', () => { const panels = {}; - const onPanelSelect = () => 'onPanelSelect'; - const wrapper = shallow(); - expect(wrapper.contains('no panels available')).to.equal(true); + expect(wrapper.contains('no panels available')).toBe(true); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/components/layout/__tests__/index.js b/packages/storybook-ui/src/modules/ui/components/layout/index.test.js similarity index 60% rename from packages/storybook-ui/src/modules/ui/components/layout/__tests__/index.js rename to packages/storybook-ui/src/modules/ui/components/layout/index.test.js index b110ad250a6d..a4c1e93331c5 100755 --- a/packages/storybook-ui/src/modules/ui/components/layout/__tests__/index.js +++ b/packages/storybook-ui/src/modules/ui/components/layout/index.test.js @@ -1,12 +1,10 @@ -const { describe, it } = global; import React from 'react'; import { shallow } from 'enzyme'; -import Layout from '../index.js'; -import { expect } from 'chai'; +import Layout from './index.js'; describe('manager.ui.components.layout.index', () => { describe('with default options', () => { - it('should render provided components', () => { + test('should render provided components', () => { const wrap = shallow( { />, ); - expect(wrap.html()).to.match(/LeftPanel/); - expect(wrap.html()).to.match(/DownPanel/); - expect(wrap.html()).to.match(/Preview/); + const markup = wrap.html(); + expect(markup).toMatch(/LeftPanel/); + expect(markup).toMatch(/DownPanel/); + expect(markup).toMatch(/Preview/); }); }); describe('with goFullScreen=true', () => { - it('should only render preview', () => { + test('should only render preview', () => { const wrap = shallow( { />, ); - expect(wrap.html()).not.to.match(/LeftPanel/); - expect(wrap.html()).not.to.match(/DownPanel/); - expect(wrap.html()).to.match(/Preview/); + const markup = wrap.html(); + expect(markup).not.toMatch(/LeftPanel/); + expect(markup).not.toMatch(/DownPanel/); + expect(markup).toMatch(/Preview/); }); }); describe('with showLeftPanel=false', () => { - it('should hide the leftPanel', () => { + test('should hide the leftPanel', () => { const wrap = shallow( { />, ); - expect(wrap.html()).not.to.match(/LeftPanel/); - expect(wrap.html()).to.match(/DownPanel/); - expect(wrap.html()).to.match(/Preview/); + const markup = wrap.html(); + expect(markup).not.toMatch(/LeftPanel/); + expect(markup).toMatch(/DownPanel/); + expect(markup).toMatch(/Preview/); }); }); describe('with showDownPanel=false', () => { - it('should hide the downPanel', () => { + test('should hide the downPanel', () => { const wrap = shallow( { />, ); - expect(wrap.html()).to.match(/LeftPanel/); - expect(wrap.html()).not.to.match(/DownPanel/); - expect(wrap.html()).to.match(/Preview/); + const markup = wrap.html(); + expect(markup).toMatch(/LeftPanel/); + expect(markup).not.toMatch(/DownPanel/); + expect(markup).toMatch(/Preview/); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/header.js b/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/header.js deleted file mode 100755 index 1e7b4f67a1bb..000000000000 --- a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/header.js +++ /dev/null @@ -1,16 +0,0 @@ -const { describe, it } = global; -import React from 'react'; -import { shallow } from 'enzyme'; -import Header from '../header.js'; -import { expect } from 'chai'; -import sinon from 'sinon'; - -describe('manager.ui.components.left_panel.header', () => { - it('should fire openShortcutsHelp when clicked on shortcut button', () => { - const openShortcutsHelp = sinon.stub(); - const wrap = shallow(
); - - wrap.find('button').simulate('click'); - expect(openShortcutsHelp.callCount).to.be.equal(1); - }); -}); diff --git a/packages/storybook-ui/src/modules/ui/components/left_panel/header.test.js b/packages/storybook-ui/src/modules/ui/components/left_panel/header.test.js new file mode 100755 index 000000000000..506044fb1986 --- /dev/null +++ b/packages/storybook-ui/src/modules/ui/components/left_panel/header.test.js @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import Header from './header.js'; + +describe('manager.ui.components.left_panel.header', () => { + test('should fire openShortcutsHelp when clicked on shortcut button', () => { + const openShortcutsHelp = jest.fn(); + const wrap = shallow(
); + + wrap.find('button').simulate('click'); + + expect(openShortcutsHelp).toHaveBeenCalled(); + }); +}); diff --git a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/index.js b/packages/storybook-ui/src/modules/ui/components/left_panel/index.test.js similarity index 54% rename from packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/index.js rename to packages/storybook-ui/src/modules/ui/components/left_panel/index.test.js index 194d0aa383b0..d2f071984fd2 100755 --- a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/index.js +++ b/packages/storybook-ui/src/modules/ui/components/left_panel/index.test.js @@ -1,40 +1,37 @@ -const { describe, it } = global; import React from 'react'; import { shallow } from 'enzyme'; -import LeftPanel from '../index'; -import Header from '../header'; -import TextFilter from '../text_filter'; -import Stories from '../stories'; -import { expect } from 'chai'; -import sinon from 'sinon'; +import LeftPanel from './index'; +import Header from './header'; +import TextFilter from './text_filter'; +import Stories from './stories'; describe('manager.ui.components.left_panel.index', () => { - it('should render Header and TextFilter by default', () => { - const openShortcutsHelp = sinon.stub(); + test('should render Header and TextFilter by default', () => { + const openShortcutsHelp = jest.fn(); const storyFilter = 'xxxxx'; - const wrap = shallow( , ); + const header = wrap.find(Header).first(); - expect(header.props().openShortcutsHelp).to.be.equal(openShortcutsHelp); + expect(header).toHaveProp('openShortcutsHelp', openShortcutsHelp); const textFilter = wrap.find(TextFilter).first(); - expect(textFilter.props().text).to.be.equal(storyFilter); + expect(textFilter).toHaveProp('text', storyFilter); - expect(wrap.find(Stories).length).to.be.equal(0); + expect(wrap.find(Stories)).toBeEmpty(); }); - it('should render stories only if stories prop exists', () => { + test('should render stories only if stories prop exists', () => { const selectedKind = 'kk'; const selectedStory = 'bb'; const stories = [{ kind: 'kk', stories: ['bb'] }]; - const wrap = shallow( , ); + const header = wrap.find(Stories).first(); - expect(header.props()).to.deep.equal({ + expect(header.props()).toEqual({ stories, selectedKind, selectedStory, @@ -42,27 +39,25 @@ describe('manager.ui.components.left_panel.index', () => { }); describe('onStoryFilter prop', () => { - it('should set filter as an empty text on TextFilter.onClear', () => { - const onStoryFilter = sinon.stub(); - + test('should set filter as an empty text on TextFilter.onClear', () => { + const onStoryFilter = jest.fn(); const wrap = shallow(); const textFilter = wrap.find(TextFilter).first(); textFilter.props().onClear(); - expect(onStoryFilter.firstCall.args).to.deep.equal(['']); + expect(onStoryFilter).toHaveBeenCalledWith(''); }); - it('should set filter as the given text of TextFilter.onChange', () => { - const onStoryFilter = sinon.stub(); + test('should set filter as the given text of TextFilter.onChange', () => { + const onStoryFilter = jest.fn(); const filterText = 'XXX'; - const wrap = shallow(); const textFilter = wrap.find(TextFilter).first(); textFilter.props().onChange(filterText); - expect(onStoryFilter.firstCall.args).to.deep.equal([filterText]); + expect(onStoryFilter).toHaveBeenCalledWith(filterText); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/stories.js b/packages/storybook-ui/src/modules/ui/components/left_panel/stories.test.js similarity index 63% rename from packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/stories.js rename to packages/storybook-ui/src/modules/ui/components/left_panel/stories.test.js index d629a7656439..3b7c5ab21c71 100755 --- a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/stories.js +++ b/packages/storybook-ui/src/modules/ui/components/left_panel/stories.test.js @@ -1,34 +1,33 @@ -const { describe, it } = global; -import { expect } from 'chai'; import { shallow } from 'enzyme'; import React from 'react'; -import sinon from 'sinon'; -import Stories from '../stories'; +import Stories from './stories'; describe('manager.ui.components.left_panel.stories', () => { describe('render', () => { - it('should render stories - empty', () => { + test('should render stories - empty', () => { const data = []; const wrap = shallow(); + const list = wrap.find('div').first().children('div').last(); - expect(list.text()).to.equal(''); + + expect(list.text()).toBe(''); }); - it('should render stories', () => { + test('should render stories', () => { const data = [{ kind: 'a', stories: ['a1', 'a2'] }, { kind: '20', stories: ['b1', 'b2'] }]; const wrap = shallow(); const output = wrap.html(); - expect(output).to.match(/20/); - expect(output).to.match(/b2/); + + expect(output).toMatch(/20/); + expect(output).toMatch(/b2/); }); }); describe('events', () => { - it('should call the onSelectStory prop when a kind is clicked', () => { + test('should call the onSelectStory prop when a kind is clicked', () => { const data = [{ kind: 'a', stories: ['a1', 'a2'] }, { kind: 'b', stories: ['b1', 'b2'] }]; - const onSelectStory = sinon.spy(); - + const onSelectStory = jest.fn(); const wrap = shallow( { const kind = wrap.find('a').filterWhere(el => el.text() === 'a').last(); kind.simulate('click'); - expect(onSelectStory.calledOnce).to.equal(true); - expect(onSelectStory.firstCall.args).to.deep.equal(['a', null]); + + expect(onSelectStory).toHaveBeenCalledWith('a', null); }); - it('should call the onSelectStory prop when a story is clicked', () => { + test('should call the onSelectStory prop when a story is clicked', () => { const data = [{ kind: 'a', stories: ['a1', 'a2'] }, { kind: 'b', stories: ['b1', 'b2'] }]; - const onSelectStory = sinon.spy(); - + const onSelectStory = jest.fn(); const wrap = shallow( { const kind = wrap.find('a').filterWhere(el => el.text() === 'b1').last(); kind.simulate('click'); - expect(onSelectStory.calledOnce).to.equal(true); - expect(onSelectStory.firstCall.args).to.deep.equal(['b', 'b1']); + + expect(onSelectStory).toHaveBeenCalledWith('b', 'b1'); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/text_filter.js b/packages/storybook-ui/src/modules/ui/components/left_panel/text_filter.test.js similarity index 52% rename from packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/text_filter.js rename to packages/storybook-ui/src/modules/ui/components/left_panel/text_filter.test.js index 49175aea3f9b..e1f99d1d90cf 100755 --- a/packages/storybook-ui/src/modules/ui/components/left_panel/__tests__/text_filter.js +++ b/packages/storybook-ui/src/modules/ui/components/left_panel/text_filter.test.js @@ -1,46 +1,45 @@ -const { describe, it } = global; -import { expect } from 'chai'; import { shallow } from 'enzyme'; import React from 'react'; -import sinon from 'sinon'; -import TextFilter from '../text_filter'; +import TextFilter from './text_filter'; describe('manager.ui.components.left_panel.test_filter', () => { describe('render', () => { - it('should render input without filterText', () => { + test('should render input without filterText', () => { const wrap = shallow(); const input = wrap.find('input').first(); - expect(input.props().placeholder).to.equal('Filter'); + + expect(input).toHaveProp('placeholder', 'Filter'); }); - it('should render input with filterText', () => { + test('should render input with filterText', () => { const wrap = shallow(); const input = wrap.find('input').first(); - expect(input.props().value).to.equal('Filter Text'); + + expect(input).toHaveProp('value', 'Filter Text'); }); }); describe('functions', () => { - it('should call the onChange prop when input changes', () => { - const onChange = sinon.spy(); + test('should call the onChange prop when input changes', () => { + const onChange = jest.fn(); const wrap = shallow(); + const input = wrap.find('input').first(); input.value = 'new value'; input.simulate('change', { target: input }); - expect(onChange.calledOnce).to.equal(true); - expect(onChange.firstCall.calledWith('new value')); + + expect(onChange).toHaveBeenCalledWith('new value'); }); - it('should call the onClear prop when the button is clicked', () => { - const onClear = sinon.spy(); + test('should call the onClear prop when the button is clicked', () => { + const onClear = jest.fn(); const wrap = shallow(); - wrap.setState({ query: 'hello' }); const clear = wrap.find('.clear'); - clear.simulate('click'); - expect(onClear.calledOnce).to.equal(true); + + expect(onClear).toHaveBeenCalled(); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/configs/__tests__/init_panels.js b/packages/storybook-ui/src/modules/ui/configs/__tests__/init_panels.js deleted file mode 100644 index 78f70973fb73..000000000000 --- a/packages/storybook-ui/src/modules/ui/configs/__tests__/init_panels.js +++ /dev/null @@ -1,30 +0,0 @@ -import initPanels from '../init_panels'; -import { expect } from 'chai'; -import sinon from 'sinon'; -const { describe, it } = global; - -describe('manager.ui.config.init_panels', () => { - it('should call the selectDownPanel with first panel name', () => { - const actions = { - ui: { - selectDownPanel: sinon.mock(), - }, - }; - - const provider = { - getPanels() { - return { - test1: {}, - test2: {}, - test3: {}, - }; - }, - }; - - initPanels({ provider }, actions); - - /* eslint-disable no-unused-expressions */ - expect(actions.ui.selectDownPanel.calledWith('test1')).to.be.true; - /* eslint-enable no-unused-expressions */ - }); -}); diff --git a/packages/storybook-ui/src/modules/ui/configs/__tests__/handle_keyevents.js b/packages/storybook-ui/src/modules/ui/configs/handle_keyevents.test.js similarity index 68% rename from packages/storybook-ui/src/modules/ui/configs/__tests__/handle_keyevents.js rename to packages/storybook-ui/src/modules/ui/configs/handle_keyevents.test.js index d00e4e9d8fdb..168a1543c77f 100755 --- a/packages/storybook-ui/src/modules/ui/configs/__tests__/handle_keyevents.js +++ b/packages/storybook-ui/src/modules/ui/configs/handle_keyevents.test.js @@ -1,17 +1,13 @@ -import handleKeyEvents from '../handle_keyevents'; -import { expect } from 'chai'; -const { describe, it } = global; -import sinon from 'sinon'; +import handleKeyEvents from './handle_keyevents'; import keycode from 'keycode'; describe('manager.ui.config.handle_keyevents', () => { - it('should call the correct action', () => { + test('should call the correct action', () => { const actions = { shortcuts: { - handleEvent: sinon.mock(), + handleEvent: jest.fn(), }, }; - const originalOnkeydown = window.onkeydown; handleKeyEvents(actions); @@ -27,20 +23,19 @@ describe('manager.ui.config.handle_keyevents', () => { }, }, }; - window.onkeydown(e); + expect(actions.shortcuts.handleEvent).toHaveBeenCalled(); + window.onkeydown = originalOnkeydown; - expect(actions.shortcuts.handleEvent.callCount).to.be.equal(1); }); - it('should not call any actions if the event target is an input', () => { + test('should not call any actions if the event target is an input', () => { const actions = { shortcuts: { - handleEvent: sinon.mock(), + handleEvent: jest.fn(), }, }; - const originalOnkeydown = window.onkeydown; handleKeyEvents(actions); @@ -56,17 +51,17 @@ describe('manager.ui.config.handle_keyevents', () => { }, }, }; - window.onkeydown(e); + expect(actions.shortcuts.handleEvent).not.toHaveBeenCalled(); + window.onkeydown = originalOnkeydown; - expect(actions.shortcuts.handleEvent.callCount).to.be.equal(0); }); - it('should not call any actions if the event target has contenteditable enabled', () => { + test('should not call any actions if the event target has contenteditable enabled', () => { const actions = { shortcuts: { - handleEvent: sinon.mock(), + handleEvent: jest.fn(), }, }; @@ -88,7 +83,8 @@ describe('manager.ui.config.handle_keyevents', () => { window.onkeydown(e); + expect(actions.shortcuts.handleEvent).not.toHaveBeenCalled(); + window.onkeydown = originalOnkeydown; - expect(actions.shortcuts.handleEvent.callCount).to.be.equal(0); }); }); diff --git a/packages/storybook-ui/src/modules/ui/configs/__tests__/handle_routing.js b/packages/storybook-ui/src/modules/ui/configs/handle_routing.test.js similarity index 55% rename from packages/storybook-ui/src/modules/ui/configs/__tests__/handle_routing.js rename to packages/storybook-ui/src/modules/ui/configs/handle_routing.test.js index e1f4d099cfe8..e8aa611776cc 100755 --- a/packages/storybook-ui/src/modules/ui/configs/__tests__/handle_routing.js +++ b/packages/storybook-ui/src/modules/ui/configs/handle_routing.test.js @@ -1,18 +1,15 @@ -import { changeUrl, handleInitialUrl, config } from '../handle_routing'; -import { expect } from 'chai'; -const { describe, it } = global; -import sinon from 'sinon'; +import { changeUrl, handleInitialUrl, config } from './handle_routing'; describe('manager.ui.config.handle_routing', () => { describe('changeUrl', () => { - it('should not do anything if insidePopState=true', () => { + test('should not do anything if insidePopState=true', () => { config.insidePopState = true; // This should throws an error if insidePopState = false changeUrl(null); config.insidePopState = false; }); - it('should put the correct URL and state to pushState', done => { + test('should put the correct URL and state to pushState', done => { const state = { selectedKind: 'kk', selectedStory: 'ss', @@ -27,12 +24,9 @@ describe('manager.ui.config.handle_routing', () => { }, selectedDownPanel: 'pp', }; - const clientStore = { getAll: () => state, }; - - // eslint-disable-next-line max-len const url = '?customText=test&selectedKind=kk&selectedStory=ss&full=0&down=1&left=1&panelRight=1&downPanel=pp'; @@ -47,34 +41,33 @@ describe('manager.ui.config.handle_routing', () => { downPanel: 'pp', customText: 'test', }; - const originalPushState = window.history.pushState; window.history.pushState = function(s, t, u) { - expect(s).to.deep.equal(pushState); - expect(u).to.be.equal(pushState.url); + expect(s).toEqual(pushState); + expect(u).toBe(pushState.url); done(); }; + changeUrl(clientStore); + window.history.pushState = originalPushState; }); }); describe('handleInitialUrl', () => { - it('should call the correct action according to URL', () => { + test('should call the correct action according to URL', () => { const actions = { api: { - selectStory: sinon.mock(), - setQueryParams: sinon.mock(), + selectStory: jest.fn(), + setQueryParams: jest.fn(), }, shortcuts: { - setOptions: sinon.mock(), + setOptions: jest.fn(), }, ui: { - selectDownPanel: sinon.mock(), + selectDownPanel: jest.fn(), }, }; - - // eslint-disable-next-line max-len const url = '?selectedKind=kk&selectedStory=ss&full=1&down=0&left=0&panelRight=0&downPanel=test&customText=teststring'; @@ -84,21 +77,19 @@ describe('manager.ui.config.handle_routing', () => { window.location.search = url; handleInitialUrl(actions, location); - expect(actions.api.selectStory.callCount).to.be.equal(1); - expect(actions.shortcuts.setOptions.callCount).to.be.equal(1); - expect(actions.ui.selectDownPanel.callCount).to.be.equal(1); - /* eslint-disable no-unused-expressions */ - expect( - actions.shortcuts.setOptions.calledWith({ - goFullScreen: true, - showDownPanel: false, - showLeftPanel: false, - downPanelInRight: false, - }), - ).to.be.true; - expect(actions.ui.selectDownPanel.calledWith('test')).to.be.true; - expect(actions.api.setQueryParams.calledWith({ customText: 'teststring' })).to.be.true; - /* eslint-enable no-unused-expressions */ + expect(actions.api.selectStory).toHaveBeenCalled(); + expect(actions.shortcuts.setOptions).toHaveBeenCalled(); + expect(actions.ui.selectDownPanel).toHaveBeenCalled(); + expect(actions.shortcuts.setOptions).toHaveBeenCalledWith({ + goFullScreen: true, + showDownPanel: false, + showLeftPanel: false, + downPanelInRight: false, + }); + expect(actions.ui.selectDownPanel).toHaveBeenCalledWith('test'); + expect(actions.api.setQueryParams).toHaveBeenCalledWith({ + customText: 'teststring', + }); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/configs/init_panels.test.js b/packages/storybook-ui/src/modules/ui/configs/init_panels.test.js new file mode 100644 index 000000000000..c8bbce25711f --- /dev/null +++ b/packages/storybook-ui/src/modules/ui/configs/init_panels.test.js @@ -0,0 +1,25 @@ +import initPanels from './init_panels'; + +describe('manager.ui.config.init_panels', () => { + test('should call the selectDownPanel with first panel name', () => { + const actions = { + ui: { + selectDownPanel: jest.fn(), + }, + }; + + const provider = { + getPanels() { + return { + test1: {}, + test2: {}, + test3: {}, + }; + }, + }; + + initPanels({ provider }, actions); + + expect(actions.ui.selectDownPanel).toHaveBeenCalledWith('test1'); + }); +}); diff --git a/packages/storybook-ui/src/modules/ui/containers/__tests__/down_panel.js b/packages/storybook-ui/src/modules/ui/containers/down_panel.test.js similarity index 62% rename from packages/storybook-ui/src/modules/ui/containers/__tests__/down_panel.js rename to packages/storybook-ui/src/modules/ui/containers/down_panel.test.js index 1a4748c74864..1cc31672e3b5 100644 --- a/packages/storybook-ui/src/modules/ui/containers/__tests__/down_panel.js +++ b/packages/storybook-ui/src/modules/ui/containers/down_panel.test.js @@ -1,10 +1,8 @@ -const { describe, it } = global; -import { expect } from 'chai'; -import { mapper } from '../down_panel'; +import { mapper } from './down_panel'; describe('manager.ui.containers.down_panel', () => { describe('mapper', () => { - it('should give correct data', () => { + test('should give correct data', () => { const state = { selectedDownPanel: 'sdp', }; @@ -31,10 +29,11 @@ describe('manager.ui.containers.down_panel', () => { }), }; - const data = mapper(state, props, env); - expect(data.panels).to.deep.equal(panels); - expect(data.selectedPanel).to.deep.equal('sdp'); - expect(data.onPanelSelect).to.equal(selectDownPanel); + const result = mapper(state, props, env); + + expect(result.panels).toEqual(panels); + expect(result.selectedPanel).toEqual('sdp'); + expect(result.onPanelSelect).toBe(selectDownPanel); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/containers/__tests__/layout.js b/packages/storybook-ui/src/modules/ui/containers/layout.test.js similarity index 59% rename from packages/storybook-ui/src/modules/ui/containers/__tests__/layout.js rename to packages/storybook-ui/src/modules/ui/containers/layout.test.js index 8de9dfefb3a6..b837078d660d 100755 --- a/packages/storybook-ui/src/modules/ui/containers/__tests__/layout.js +++ b/packages/storybook-ui/src/modules/ui/containers/layout.test.js @@ -1,10 +1,8 @@ -const { describe, it } = global; -import { expect } from 'chai'; -import { mapper } from '../layout'; +import { mapper } from './layout'; describe('manager.ui.containers.layout', () => { describe('mapper', () => { - it('should give correct data', () => { + test('should give correct data', () => { const state = { shortcutOptions: { showLeftPanel: 'aa', @@ -12,9 +10,9 @@ describe('manager.ui.containers.layout', () => { goFullScreen: 'cc', }, }; - const data = mapper(state); - expect(data).to.deep.equal(state.shortcutOptions); + + expect(data).toEqual(state.shortcutOptions); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/containers/__tests__/left_panel.js b/packages/storybook-ui/src/modules/ui/containers/left_panel.test.js similarity index 74% rename from packages/storybook-ui/src/modules/ui/containers/__tests__/left_panel.js rename to packages/storybook-ui/src/modules/ui/containers/left_panel.test.js index 649597380266..e0476046d13d 100755 --- a/packages/storybook-ui/src/modules/ui/containers/__tests__/left_panel.js +++ b/packages/storybook-ui/src/modules/ui/containers/left_panel.test.js @@ -1,10 +1,8 @@ -const { describe, it } = global; -import { expect } from 'chai'; -import { mapper } from '../left_panel'; +import { mapper } from './left_panel'; describe('manager.ui.containers.left_panel', () => { describe('mapper', () => { - it('should give correct data', () => { + test('should give correct data', () => { const stories = [{ kind: 'sk', stories: ['dd'] }]; const selectedKind = 'sk'; const selectedStory = 'dd'; @@ -12,11 +10,9 @@ describe('manager.ui.containers.left_panel', () => { name: 'foo', url: 'bar', }; - const selectStory = () => 'selectStory'; const toggleShortcutsHelp = () => 'toggleShortcutsHelp'; const setStoryFilter = () => 'setStoryFilter'; - const props = {}; const env = { actions: () => ({ @@ -29,7 +25,6 @@ describe('manager.ui.containers.left_panel', () => { }, }), }; - const state = { storyFilter: null, stories, @@ -37,19 +32,18 @@ describe('manager.ui.containers.left_panel', () => { selectedStory, uiOptions, }; - - const data = mapper(state, props, env); - expect(data.stories).to.deep.equal(stories); - expect(data.selectedKind).to.be.equal(selectedKind); - expect(data.selectedStory).to.be.equal(selectedStory); - expect(data.storyFilter).to.be.equal(null); - - expect(data.onSelectStory).to.be.equal(selectStory); - expect(data.onStoryFilter).to.be.equal(setStoryFilter); - expect(data.openShortcutsHelp).to.be.equal(toggleShortcutsHelp); + const result = mapper(state, props, env); + + expect(result.stories).toEqual(stories); + expect(result.selectedKind).toBe(selectedKind); + expect(result.selectedStory).toBe(selectedStory); + expect(result.storyFilter).toBe(null); + expect(result.onSelectStory).toBe(selectStory); + expect(result.onStoryFilter).toBe(setStoryFilter); + expect(result.openShortcutsHelp).toBe(toggleShortcutsHelp); }); - it('should filter stories according to the given filter', () => { + test('should filter stories according to the given filter', () => { const stories = [ { kind: 'pk', stories: ['dd'] }, { kind: 'ss', stories: ['dd'] }, @@ -61,11 +55,9 @@ describe('manager.ui.containers.left_panel', () => { name: 'foo', url: 'bar', }; - const selectStory = () => 'selectStory'; const toggleShortcutsHelp = () => 'toggleShortcutsHelp'; const setStoryFilter = () => 'setStoryFilter'; - const props = {}; const env = { actions: () => ({ @@ -78,7 +70,6 @@ describe('manager.ui.containers.left_panel', () => { }, }), }; - const state = { storyFilter: 'ss', stories, @@ -86,15 +77,15 @@ describe('manager.ui.containers.left_panel', () => { selectedStory, uiOptions, }; + const result = mapper(state, props, env); - const data = mapper(state, props, env); - expect(data.stories).to.deep.equal([ + expect(result.stories).toEqual([ stories[0], // selected kind is always there. That's why this is here. stories[1], ]); }); - it('should filter and sort stories according to the given filter', () => { + test('should filter and sort stories according to the given filter', () => { const stories = [ { kind: 'ss', stories: ['dd'] }, { kind: 'pk', stories: ['dd'] }, @@ -107,11 +98,9 @@ describe('manager.ui.containers.left_panel', () => { url: 'bar', sortStoriesByKind: true, }; - const selectStory = () => 'selectStory'; const toggleShortcutsHelp = () => 'toggleShortcutsHelp'; const setStoryFilter = () => 'setStoryFilter'; - const props = {}; const env = { actions: () => ({ @@ -124,7 +113,6 @@ describe('manager.ui.containers.left_panel', () => { }, }), }; - const state = { storyFilter: 'ss', stories, @@ -132,9 +120,9 @@ describe('manager.ui.containers.left_panel', () => { selectedStory, uiOptions, }; + const result = mapper(state, props, env); - const data = mapper(state, props, env); - expect(data.stories).to.deep.equal([ + expect(result.stories).toEqual([ stories[1], // selected kind is always there. That's why this is here. stories[0], ]); diff --git a/packages/storybook-ui/src/modules/ui/containers/__tests__/shortcuts_help.js b/packages/storybook-ui/src/modules/ui/containers/shortcuts_help.test.js similarity index 55% rename from packages/storybook-ui/src/modules/ui/containers/__tests__/shortcuts_help.js rename to packages/storybook-ui/src/modules/ui/containers/shortcuts_help.test.js index 72caceff7379..d43a14b88eab 100755 --- a/packages/storybook-ui/src/modules/ui/containers/__tests__/shortcuts_help.js +++ b/packages/storybook-ui/src/modules/ui/containers/shortcuts_help.test.js @@ -1,13 +1,10 @@ -const { describe, it } = global; -import { expect } from 'chai'; -import { mapper } from '../shortcuts_help'; +import { mapper } from './shortcuts_help'; describe('manager.ui.containers.shortcuts_help', () => { describe('mapper', () => { - it('should give correct data', () => { + test('should give correct data', () => { const toggleShortcutsHelp = () => null; const showShortcutsHelp = true; - const props = {}; const env = { actions: () => ({ @@ -20,10 +17,10 @@ describe('manager.ui.containers.shortcuts_help', () => { const state = { showShortcutsHelp, }; + const result = mapper(state, props, env); - const data = mapper(state, props, env); - expect(data.isOpen).to.be.equal(showShortcutsHelp); - expect(data.onClose).to.be.equal(toggleShortcutsHelp); + expect(result.isOpen).toBe(showShortcutsHelp); + expect(result.onClose).toBe(toggleShortcutsHelp); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/libs/__tests__/filters.js b/packages/storybook-ui/src/modules/ui/libs/filters.test.js similarity index 60% rename from packages/storybook-ui/src/modules/ui/libs/__tests__/filters.js rename to packages/storybook-ui/src/modules/ui/libs/filters.test.js index 03b0c5e2c200..638776289b2e 100755 --- a/packages/storybook-ui/src/modules/ui/libs/__tests__/filters.js +++ b/packages/storybook-ui/src/modules/ui/libs/filters.test.js @@ -1,29 +1,27 @@ -import { storyFilter } from '../filters'; -import { expect } from 'chai'; -const { describe, it } = global; +import { storyFilter } from './filters'; describe('manager.ui.libs.filters', () => { describe('storyFilter', () => { - it('should return null if there are no stories', () => { + test('should return null if there are no stories', () => { const res = storyFilter(); - expect(res).to.be.equal(null); + expect(res).toBe(null); }); - it('should original stories if there is no filter', () => { + test('should original stories if there is no filter', () => { const stories = [{ kind: 'aa', stories: ['bb'] }]; const res = storyFilter(stories); - expect(res).to.be.equal(stories); + expect(res).toBe(stories); }); - it('should always return the selectedKind', () => { + test('should always return the selectedKind', () => { const stories = [{ kind: 'aa', stories: ['bb'] }, { kind: 'bb', stories: ['bb'] }]; const selectedKind = 'bb'; const res = storyFilter(stories, 'no-match', selectedKind); - expect(res).to.deep.equal([stories[1]]); + expect(res).toEqual([stories[1]]); }); - it('should filter kinds correctly', () => { + test('should filter kinds correctly', () => { const stories = [ { kind: 'aa', stories: ['bb'] }, { kind: 'bb', stories: ['bb'] }, @@ -32,10 +30,10 @@ describe('manager.ui.libs.filters', () => { const selectedKind = 'bb'; const res = storyFilter(stories, 'aa', selectedKind); - expect(res).to.deep.equal([stories[0], stories[1]]); + expect(res).toEqual([stories[0], stories[1]]); }); - it('should not sort stories by kind', () => { + test('should not sort stories by kind', () => { const stories = [ { kind: 'ss', stories: ['bb'] }, { kind: 'aa', stories: ['bb'] }, @@ -43,10 +41,10 @@ describe('manager.ui.libs.filters', () => { ]; const res = storyFilter(stories); - expect(res).to.equal(stories); + expect(res).toBe(stories); }); - it('should sort stories by kind', () => { + test('should sort stories by kind', () => { const stories = [ { kind: 'ss', stories: ['bb'] }, { kind: 'aa', stories: ['bb'] }, @@ -54,7 +52,7 @@ describe('manager.ui.libs.filters', () => { ]; const res = storyFilter(stories, null, null, true); - expect(res).to.deep.equal([stories[1], stories[2], stories[0]]); + expect(res).toEqual([stories[1], stories[2], stories[0]]); }); }); }); diff --git a/packages/storybook-ui/src/modules/ui/libs/__tests__/gen_podda_loader.js b/packages/storybook-ui/src/modules/ui/libs/gen_podda_loader.test.js similarity index 74% rename from packages/storybook-ui/src/modules/ui/libs/__tests__/gen_podda_loader.js rename to packages/storybook-ui/src/modules/ui/libs/gen_podda_loader.test.js index 313af25f3e93..3d35acc2affa 100644 --- a/packages/storybook-ui/src/modules/ui/libs/__tests__/gen_podda_loader.js +++ b/packages/storybook-ui/src/modules/ui/libs/gen_podda_loader.test.js @@ -1,8 +1,5 @@ -import genPoddaLoader from '../gen_podda_loader'; +import genPoddaLoader from './gen_podda_loader'; import Podda from 'podda'; -import { expect } from 'chai'; -import sinon from 'sinon'; -const { describe, it } = global; describe('manager.ui.libs.gen_podda_loader', () => { describe('mapper', () => { @@ -14,13 +11,13 @@ describe('manager.ui.libs.gen_podda_loader', () => { aa: state.aa, bb: state.bb, }); - const clientStore = new Podda({ aa, bb, cc }); const loader = genPoddaLoader(mapper); - const onData = sinon.stub(); + const onData = jest.fn(); loader({}, onData, { context: () => ({ clientStore }) }); - expect(onData.args[0]).to.deep.equal([null, { aa, bb }]); + + expect(onData).toHaveBeenCalledWith(null, { aa, bb }); }); it('should get props', () => { @@ -31,13 +28,13 @@ describe('manager.ui.libs.gen_podda_loader', () => { aa: props.aa, bb: props.bb, }); - const clientStore = new Podda(); const loader = genPoddaLoader(mapper); - const onData = sinon.stub(); + const onData = jest.fn(); loader({ aa, bb, cc }, onData, { context: () => ({ clientStore }) }); - expect(onData.args[0]).to.deep.equal([null, { aa, bb }]); + + expect(onData).toHaveBeenCalledWith(null, { aa, bb }); }); it('should get env', () => { @@ -52,9 +49,10 @@ describe('manager.ui.libs.gen_podda_loader', () => { const clientStore = new Podda(); const loader = genPoddaLoader(mapper); - const onData = sinon.stub(); + const onData = jest.fn(); loader({}, onData, { context: () => ({ clientStore }), aa, bb, cc }); - expect(onData.args[0]).to.deep.equal([null, { aa, bb }]); + + expect(onData).toHaveBeenCalledWith(null, { aa, bb }); }); }); @@ -63,13 +61,13 @@ describe('manager.ui.libs.gen_podda_loader', () => { const mapper = () => { throw new Error('this is the error'); }; - const clientStore = new Podda(); const loader = genPoddaLoader(mapper); - const onData = sinon.stub(); + const onData = jest.fn(); loader({}, onData, { context: () => ({ clientStore }) }); - expect(onData.args[0][0]).to.match(/this is the error/); + + expect(onData.mock.calls[0].toString()).toMatch(/this is the error/); }); it('should run when the podda store changed', () => { @@ -80,14 +78,14 @@ describe('manager.ui.libs.gen_podda_loader', () => { aa: state.aa, bb: state.bb, }); - const clientStore = new Podda({ aa, bb, cc }); const loader = genPoddaLoader(mapper); - const onData = sinon.stub(); + const onData = jest.fn(); loader({ aa, bb, cc }, onData, { context: () => ({ clientStore }) }); clientStore.set('aa', 1000); - expect(onData.args[1]).to.deep.equal([null, { aa: 1000, bb }]); + + expect(onData).toHaveBeenCalledWith(null, { aa: 1000, bb }); }); it('should not run when podda subscription stopped', () => { @@ -98,15 +96,17 @@ describe('manager.ui.libs.gen_podda_loader', () => { aa: state.aa, bb: state.bb, }); - const clientStore = new Podda({ aa, bb, cc }); const loader = genPoddaLoader(mapper); - const onData = sinon.stub(); - const stop = loader({ aa, bb, cc }, onData, { context: () => ({ clientStore }) }); + const onData = jest.fn(); + const stop = loader({ aa, bb, cc }, onData, { + context: () => ({ clientStore }), + }); stop(); clientStore.set('aa', 1000); - expect(onData.callCount).to.be.equal(1); + + expect(onData).toHaveBeenCalled(); }); }); }); diff --git a/packages/storyshots/package.json b/packages/storyshots/package.json index da90bf899211..9739ad9e2b97 100644 --- a/packages/storyshots/package.json +++ b/packages/storyshots/package.json @@ -10,25 +10,21 @@ "main": "dist/index.js", "scripts": { "prepublish": "babel ./src --out-dir ./dist", - "test": "jest", "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook" }, "devDependencies": { "babel-cli": "^6.14.0", - "babel-jest": "^18.0.0", "babel-plugin-transform-runtime": "^6.15.0", "babel-preset-es2015": "^6.18.0", "babel-preset-react": "^6.16.0", - "jest": "^18.0.0", "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-test-renderer": "^15.5.4" + "react-dom": "^15.5.4" }, "dependencies": { - "@kadira/storybook": "^2.21.0", - "@kadira/storybook-addons": "^1.6.1", - "@kadira/storybook-channel": "^1.1.0", + "@kadira/storybook": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-channel": "*", "babel-runtime": "^6.20.0", "prop-types": "^15.5.7", "read-pkg-up": "^2.0.0" diff --git a/packages/storyshots/src/require_context.js b/packages/storyshots/src/require_context.js index 085b938a3f4a..de0b60261937 100644 --- a/packages/storyshots/src/require_context.js +++ b/packages/storyshots/src/require_context.js @@ -11,7 +11,6 @@ function requireModules(keys, root, directory, regExp, recursive) { // TODO: Check this in windows const entryKey = `./${path.join(directory, filename)}`; if (regExp.test(entryKey)) { - // eslint-disable-next-line no-param-reassign, global-require, import/no-dynamic-require keys[entryKey] = require(path.join(root, directory, filename)); return; } @@ -46,11 +45,9 @@ export default function runWithRequireContext(content, options) { const newRequire = request => { if (isRelativeRequest(request)) { - // eslint-disable-next-line global-require, import/no-dynamic-require return require(path.resolve(dirname, request)); } - // eslint-disable-next-line global-require, import/no-dynamic-require return require(request); }; diff --git a/packages/storyshots/stories/__test__/__snapshots__/storyshots.test.js.snap b/packages/storyshots/stories/__test__/__snapshots__/storyshots.test.js.snap deleted file mode 100644 index 892f4cae05bc..000000000000 --- a/packages/storyshots/stories/__test__/__snapshots__/storyshots.test.js.snap +++ /dev/null @@ -1,207 +0,0 @@ -exports[`Storyshots Another Button with some emoji 1`] = ` - -`; - -exports[`Storyshots Another Button with text 1`] = ` - -`; - -exports[`Storyshots Button with some emoji 1`] = ` - -`; - -exports[`Storyshots Button with text 1`] = ` - -`; - -exports[`Storyshots Welcome to Storybook 1`] = ` -
-

- Welcome to STORYBOOK -

-

- This is a UI component dev environment for your app. -

-

- We\'ve added some basic stories inside the - - - src/stories - - - directory. -
- A story is a single state of one or more UI components. You can have as many stories as you want. -
- (Basically a story is like a visual test case.) -

-

- See these sample - - - stories - - - for a component called - - - Button - - . -

-

- Just like that, you can add your own components as stories. -
- You can also edit those components and see changes right away. -
- (Try editing the - - Button - - component located at - - stories/Button.js - - .) -

-

- This is just one thing you can do with Storybook. -
- Have a look at the - - - React Storybook - - - repo for more information. -

-
-`; diff --git a/packages/storyshots/stories/__test__/storyshots.test.js b/packages/storyshots/stories/__test__/storyshots.test.js deleted file mode 100644 index 19d7e96f7d38..000000000000 --- a/packages/storyshots/stories/__test__/storyshots.test.js +++ /dev/null @@ -1,2 +0,0 @@ -import initStoryshots from '../../src'; -initStoryshots();