From c6cda685e34558d68e9f04bcef51180ddd0d2e27 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Thu, 12 Jan 2017 11:54:49 +0200 Subject: [PATCH] Add test documentation --- README.md | 8 ++++++++ docs/README.md | 8 ++++++++ docs/testing.md | 25 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 docs/README.md create mode 100644 docs/testing.md diff --git a/README.md b/README.md index b6312545..ee923d64 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..216cd718 --- /dev/null +++ b/docs/README.md @@ -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) diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 00000000..0cb84adb --- /dev/null +++ b/docs/testing.md @@ -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