https://github.com/orangecms/antd-jest-demo
demo to show how to test React components with some extras
https://github.com/orangecms/antd-jest-demo
Last synced: about 1 year ago
JSON representation
demo to show how to test React components with some extras
- Host: GitHub
- URL: https://github.com/orangecms/antd-jest-demo
- Owner: orangecms
- Created: 2016-12-16T06:31:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-16T06:32:08.000Z (over 9 years ago)
- Last Synced: 2025-03-25T03:12:40.148Z (about 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About 🐈
This is a demo to show how to test React components with some extras.
Involved are React, [Ant Design](http://ant.design), Babel, Jest, Enzyme, webpack, some custom CSS, cats, and emoji 🐢.
### Configuration
Here comes the tricky part. These are some things you need to consider when testing
with Jest:
* Jest automatically mocks your modules, you need to [unmock them](https://facebook.github.io/jest/docs/api.html#jestunmockmodulename) - and actually, they are stubbed
* Jest can [use tools like webpack](http://facebook.github.io/jest/docs/tutorial-webpack.html) to preprocess files
## Try it out 🚀
### Installation
Just install the Node modules:
```bash
npm i
```
### Linting
ESlint is configured as a lint script in `package.json`:
```bash
npm run lint
```
### Run the tests
The test script in `package.json` will run Jest using the default path `__tests__`:
```bash
npm test
```
### Preview the components
Components can be previewed via [React Storybook](http://getstorybook.io).
It will be available on (http://localhost:9900) if you run:
```bash
npm start
```
## LICENSE
 WTFPL (http://www.wtfpl.net/)