Advanced: Debugging the backend
- Open the backend in your IDE (
-
Add the following parameters:
test-runner-server --version-lock-file=/tmp/vlf -
Start your process. You can place breakpoints, or start under a profiler, etc.
-
The instance icon should appear in the task bar or system tray, where applicable
- In a separate IDE, open your test file and prepare a Jest run configuration for that test
- Add the following environment variable:
DEPOT_TEST_BACKEND_LOCKFILE=/tmp/vlf - Run your test. There should not be a second instance running; rather, the backend you've started manually in your IDE should produce a fair bit of log messages.
At this point you can put breakpoints in your code as well as the backend, etc.
In place of point 2, you can also run your test suite normally, e.g.
DEPOT_TEST_BACKEND_LOCKFILE=/tmp/vlf yarn run test
or
DEPOT_TEST_BACKEND_LOCKFILE=/tmp/vlf yarn test
to throw all tests at your instrumented backend.
tip
the examples above use /tmp/vlf as the lock file name; it doesn't matter what name is used provided it is
valid on your system and there isn't a process already using it.