Commit a5eb8395 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Evan Read

Add running tests to FE tips doc

parent 459285fb
...@@ -23,3 +23,7 @@ Your feature flag can now be: ...@@ -23,3 +23,7 @@ Your feature flag can now be:
- [Deleting a feature flag](../../api/features.md#delete-a-feature) - [Deleting a feature flag](../../api/features.md#delete-a-feature)
- [Manage feature flags](../feature_flags/process.md) - [Manage feature flags](../feature_flags/process.md)
- [Feature flags API](../../api/features.md) - [Feature flags API](../../api/features.md)
## Running tests locally
This can be done as outlined by the [frontend testing guide](../testing_guide/frontend_testing.md#running-frontend-tests).
...@@ -552,6 +552,7 @@ For running the frontend tests, you need the following commands: ...@@ -552,6 +552,7 @@ For running the frontend tests, you need the following commands:
- `rake frontend:fixtures` (re-)generates [fixtures](#frontend-test-fixtures). - `rake frontend:fixtures` (re-)generates [fixtures](#frontend-test-fixtures).
- `yarn test` executes the tests. - `yarn test` executes the tests.
- `yarn jest` executes only the Jest tests.
As long as the fixtures don't change, `yarn test` is sufficient (and saves you some time). As long as the fixtures don't change, `yarn test` is sufficient (and saves you some time).
...@@ -593,6 +594,24 @@ glob otherwise your shell may split it into multiple arguments: ...@@ -593,6 +594,24 @@ glob otherwise your shell may split it into multiple arguments:
yarn karma -f 'spec/javascripts/ide/**/file_spec.js' yarn karma -f 'spec/javascripts/ide/**/file_spec.js'
``` ```
It is also possible to target individual Jest / RSpec tests:
```bash
# Run specific jest file
yarn jest ./path/to/local_spec.js
# Run specific jest folder
yarn jest ./path/to/folder/
# Run all jest files which path contain term
yarn jest term
```
```bash
# Run specific rspec file
rspec ./path/to/local_spec.rb
# Run specific block within rspec file
rspec ./path/to/local_spec.rb:15
```
## Frontend test fixtures ## Frontend test fixtures
Code that is added to HAML templates (in `app/views/`) or makes Ajax requests to the backend has tests that require HTML or JSON from the backend. Code that is added to HAML templates (in `app/views/`) or makes Ajax requests to the backend has tests that require HTML or JSON from the backend.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment