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:
parent
21d6dd2cba
commit
9681fd4cf4
|
@ -268,6 +268,21 @@ yarn test && yarn build --skip-os-packages
|
||||||
### Debugging Server Code
|
### 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.
|
`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
|
### 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.
|
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.
|
||||||
|
|
|
@ -31,6 +31,12 @@ yarn test --plugins <plugin>[,<plugin>]* # where <plugin> is "reporting", etc
|
||||||
#### Running single test file
|
#### Running single test file
|
||||||
Edit test file, changing top level `describe` to `describe.only`. Run tests with normal commands.
|
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
|
#### Debugging browser tests
|
||||||
```
|
```
|
||||||
yarn test:browser:dev
|
yarn test:browser:dev
|
||||||
|
|
Loading…
Reference in a new issue