Described how to configure jest tests in IntelliJ

Signed-off-by: bogdannechyporenko <bogdannechiporenko@gmail.com>
This commit is contained in:
bogdannechyporenko
2023-01-31 12:50:46 +01:00
parent e9a6508edb
commit 690905b78b
2 changed files with 14 additions and 11 deletions
+13
View File
@@ -595,6 +595,19 @@ If you also want to enable source maps when debugging tests, you can do so by se
}
```
### Debugging Jest Tests
To configure the debugging of your tests in IntelliJ, you have to:
1. Update Jest configuration template by:
- Click on "Edit Configurations" on top panel
- In the modal dialog click on link "Edit configuration templates..." located in the bottom left corner.
- In "Jest package" you have to point to relative path of jest module (it will be suggested by IntelliJ), i.e. ~/proj/backstage/node_modules/jest
- In "Jest config" point to your jest configuration file, use absolute path for that, i.e. `--config /Users/user/proj/backstage/packages/cli/config/jest.js --runInBand`
2. Now you can run any tests by clicking on green arrow located on `describe` or `it`.
## Publishing
Package publishing is an optional part of the Backstage build system and not
+1 -11
View File
@@ -371,14 +371,4 @@ Note: wrapping in the test application **requires** you to do a `find()` or
# Debugging Jest Tests
Currently, debugging Jest tests using IntelliJ or `node-debugger` is possible
but can be
[problematic to set up.](https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000634564-Debugging-Jest-unit-tests)
It is possible, but you might spend a decent amount of time configuring your
IDE.
In most cases, we have found that using `console.log` works well.
Note: if your console.logs are not being displayed, focus your specific unit
test from the command line by running them like so `yarn test MyTest`.
You can find it [here](https://backstage.io/docs/local-dev/cli-build-system#debugging-jest-tests)