From 966078f5604433a63d9b8a442a1bc44f96ffb9f6 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Fri, 16 Mar 2018 11:28:39 +0200 Subject: [PATCH] Add instructions for attaching debugger to jest --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index c3b73dd41f774..f438ac591aaa7 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,15 @@ yarn start -- --reset-cache Runs the [jest](https://github.com/facebook/jest) test runner on your tests. +To run `jest` with debugger support, start it with the following CLI command: +``` +NODE_ENV=test node --inspect-brk node_modules/.bin/jest --runInBand +``` + +Append `--config ` to specify a config file other than the default. + +Then, open `chrome://inspect` in Chrome to attach the debugger (look into the "Remote Target" section). While testing/developing, feel free to springle `debugger` statements anywhere in the code that you'd like the debugger to break. + #### `npm run ios` Like `npm start`, but also attempts to open your app in the iOS Simulator if you're on a Mac and have it installed.