mirror of
https://github.com/AtHeartEngineering/lodestar.git
synced 2026-01-09 21:38:03 -05:00
Add guide on how to debug tests (#3719)
This commit is contained in:
@@ -22,6 +22,17 @@ Thanks for your contribution to Lodestar. It's people like you that push the Eth
|
||||
- :test_tube: Run `lerna run test:e2e` for end-to-end tests.
|
||||
- :test_tube: Run `lerna run test` to run all tests.
|
||||
|
||||
### Debugging spec tests
|
||||
|
||||
- To fix errors always focus on passing all minimal tests first without running mainnet tests.
|
||||
- Spec tests often compare full expected vs actual states in JSON format. To better understand the diff it's convenient to use mocha's option `--inline-diffs`.
|
||||
- A single logical error can cause many spec tests to fail. To focus on a single test at a time you can use mocha's option `--bail` to stop at the first failed test
|
||||
- To then run only that failed test you can run against a specific file as use mocha's option `--grep` to run only one case
|
||||
|
||||
```
|
||||
LODESTAR_PRESET=minimal ../../node_modules/.bin/mocha --config .mocharc.spec.yml test/spec/phase0/sanity.test.ts --inline-diffs --bail --grep "attestation"
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
The docker-compose file requires that a `.env` file be present in this directory. The `default.env` file provides a template and can be copied `.env`:
|
||||
|
||||
Reference in New Issue
Block a user