add jest instructions to CONTRIBUTING.md (#18620)

* add jest instructions to CONTRIBUTING.md

* remove package language and move x-pack jest instructions to x-pack/README.md
This commit is contained in:
Nathan Reese 2018-05-02 13:57:10 -06:00 committed by GitHub
parent 21d6dd2cba
commit 9681fd4cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -268,6 +268,21 @@ yarn test && yarn build --skip-os-packages
### Debugging Server Code
`yarn debug` will start the server with Node's inspect and debug-brk flags. Kibana's development mode will start three processes. Chrome's developer tools can be configured to connect to all three under the connection tab.
### Unit testing frameworks
Kibana is migrating unit testing from Mocha to Jest. Legacy unit tests still exist in Mocha but all new unit tests should be written in Jest.
#### Mocha (legacy)
Mocha tests are contained in `__tests__` directories.
#### Jest
Jest tests are stored in the same directy as source code files with the `.test.js` suffix.
### Running Jest Unit Tests
```bash
node scripts/jest
```
### Debugging Unit Tests
The standard `yarn test` task runs several sub tasks and can take several minutes to complete, making debugging failures pretty painful. In order to ease the pain specialized tasks provide alternate methods for running the tests.

View file

@ -31,6 +31,12 @@ yarn test --plugins <plugin>[,<plugin>]* # where <plugin> is "reporting", etc
#### Running single test file
Edit test file, changing top level `describe` to `describe.only`. Run tests with normal commands.
#### Running Jest Unit Tests
```bash
# from x-pack folder
node scripts/jest
```
#### Debugging browser tests
```
yarn test:browser:dev