storybook-addon-specifications
Advanced tools
Comparing version 2.1.1 to 2.1.2
{ | ||
"name": "storybook-addon-specifications", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Add tests to your react storybook stories", | ||
@@ -13,3 +13,3 @@ "main": "dist/index.js", | ||
"jest": "jest", | ||
"mocha": "mocha --compilers js:babel-register --require babel-polyfill ./.storybook/__conf__/mochaMockConfig.js \"./.storybook/**/*.mocha.stories.js\"", | ||
"mocha": "mocha --compilers js:babel-register --require babel-polyfill ./.storybook/__conf__/mochaMockConfig.js ./.storybook/__conf__/enzymeConfig.js \"./.storybook/**/*.mocha.stories.js\"", | ||
"test": "npm-run-all babel jest mocha" | ||
@@ -33,2 +33,5 @@ }, | ||
"devDependencies": { | ||
"@storybook/addons": "3.2.17", | ||
"@storybook/react": "3.2.17", | ||
"@storybook/ui": "3.2.17", | ||
"babel-cli": "^6.11.4", | ||
@@ -38,17 +41,16 @@ "babel-preset-es2015": "^6.9.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-runtime": "^6.26.0", | ||
"chai": "^4.0.2", | ||
"enzyme": "^2.4.1", | ||
"enzyme": "3.2.0", | ||
"enzyme-adapter-react-16": "^1.1.0", | ||
"expect": "^1.20.2", | ||
"jest": "^20.0.1", | ||
"jest": "^21.0.0", | ||
"json": "^9.0.4", | ||
"mocha": "^3.0.2", | ||
"npm-run-all": "^4.0.2", | ||
"react": "^15.3.0", | ||
"react-addons-test-utils": "^0.14.7 || ^15.0.0", | ||
"react-dom": "^15.3.0", | ||
"react-test-renderer": "^15.3.1", | ||
"rimraf": "^2.5.4", | ||
"@storybook/react": "3.1.5", | ||
"@storybook/ui": "3.1.5", | ||
"@storybook/addons": "3.1.5" | ||
"prop-types": "^15.6.0", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"react-test-renderer": "^16.2.0", | ||
"rimraf": "^2.5.4" | ||
}, | ||
@@ -60,8 +62,9 @@ "dependencies": { | ||
"@storybook/addons": "^3.0.0", | ||
"react": "^0.14.7 || ^15.0.0", | ||
"react-dom": "^0.14.7 || ^15.0.0" | ||
"react": "^0.14.7 || ^15.0.0 || ^16.0.0", | ||
"react-dom": "^0.14.7 || ^15.0.0 || ^16.0.0" | ||
}, | ||
"jest": { | ||
"setupFiles": [ | ||
"./.storybook/__conf__/jestMockConfig.js" | ||
"./.storybook/__conf__/jestMockConfig.js", | ||
"./.storybook/__conf__/enzymeConfig.js" | ||
], | ||
@@ -68,0 +71,0 @@ "testRegex": "../.*.ci.jest.stories.js$", |
@@ -14,2 +14,3 @@ # Specifications Addon [![npm version](https://img.shields.io/npm/v/storybook-addon-specifications.svg)](https://www.npmjs.com/package/storybook-addon-specifications) | ||
* [Getting Started](#getting-started) | ||
* [Using enzyme](#using-enzyme) | ||
* [Use your stories with a test runner](#use-your-stories-with-a-test-runner) | ||
@@ -67,16 +68,31 @@ * [Using Jest](#using-jest) | ||
> Note : if you use enzyme, you will need to add the following lines to your webpack.config.js file. You also need to add the **json library** to your dev dependencies. | ||
>``` | ||
>externals: { | ||
> 'jsdom': 'window', | ||
> 'cheerio': 'window', | ||
> 'react/lib/ExecutionEnvironment': true, | ||
> 'react/lib/ReactContext': 'window', | ||
> 'react/addons': true, | ||
> } | ||
>``` | ||
You can use `beforeEach`, `before`, `after` and `afterEach` functions to mutualize or clean up some stuff. | ||
## Using enzyme | ||
To use enzyme inside storybooks, you will need to do the following: | ||
1. Configure enzyme with an appropriate adapter inside your .storybook/config.js: | ||
```js | ||
import {configure} from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
configure({ adapter: new Adapter() }); | ||
``` | ||
2. Add the following lines to your webpack.config.js: | ||
``` | ||
externals: { | ||
'jsdom': 'window', | ||
'cheerio': 'window', | ||
'react/lib/ExecutionEnvironment': true, | ||
'react/lib/ReactContext': 'window', | ||
'react/addons': true, | ||
} | ||
``` | ||
3. Add the **json library** to your dev dependencies. | ||
## Use your stories with a test runner | ||
@@ -83,0 +99,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
992492
425
21