Add test documentation

This commit is contained in:
Kimmo Puputti 2017-01-12 11:54:49 +02:00
parent 90257a9fe9
commit c6cda685e3
3 changed files with 41 additions and 0 deletions

View file

@ -6,6 +6,10 @@ with
[create-react-app](https://github.com/facebookincubator/create-react-app) with
some additions, namely server side rendering and a custom CSS setup.
## Documentation
Documentation can be found in the [docs directory](docs/).
## Getting started
Install required tools:
@ -40,8 +44,12 @@ application code.
## Tests
To start the test watcher, run
yarn test
See more in the [testing documentation](docs/testing.md).
## Production Server
npm run build

8
docs/README.md Normal file
View file

@ -0,0 +1,8 @@
# Sharetribe Starter App Documentation
The application was bootstrapped with a forked version of [create-react-app](https://github.com/facebookincubator/create-react-app). While most of the original documentation still apply, there are some important differences listed in the [sharetribe-scripts](https://www.npmjs.com/package/sharetribe-scripts) NPM package.
Documentation for specific topics can be found in the following files:
- Original [create-react-app documentation](create-react-app.md)
- [Testing](testing.md)

25
docs/testing.md Normal file
View file

@ -0,0 +1,25 @@
# Sharetribe Starter App Testing
The test setup is based on the `create-react-app` test setup and is using the [Jest testing framework](https://facebook.github.io/jest/). See the [Testing Components](create-react-app.md#testing-components) and [Experimental Snapshot Testing](create-react-app.md#experimental-snapshot-testing) sections in the `create-react-app` documentation.
## Running tests
To start the test watcher that automatically updates when files change, run
yarn test
If you want to run the tests once and not start the watcher, run
CI=true yarn test
Note that this also runs the linter.
## Jest
To learn more about testing with Jest, read the following documentation:
- [Getting Started](https://facebook.github.io/jest/docs/getting-started.html)
- [Tutorial - React](https://facebook.github.io/jest/docs/tutorial-react.html)
- [Tutorial - Async](https://facebook.github.io/jest/docs/tutorial-async.html)
- [Snapshot Testing](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html) blog post
- [API Reference](https://facebook.github.io/jest/docs/api.html) lists the global environment with the available functions and the assertion matchers