See https://github.com/facebook/jest/issues/1652. As of this issue being fixed in Jest and Node 8.4, this should be fixed in create-react-app but I can't get it to work.
Yes
Yes
inspect
node -v: v8.4.0npm -v: 4.6.1 and 5.3.0 (confirmed on both versions)npm ls react-scripts: 1.0.11localhost:9229.debugger breakpoint in a test file.node --inspect-brk node_modules/.bin/react-scripts testChromium debugger stops on debugger breakpoint.
Chromium debugger doesn't stop on breakpoint and remains at the beginning of the script.
I'm experiencing the same issue when running jest directly with
node --inspect --inspect-brk node_modules/jest/bin/jest.js --watch
node --version
v8.4.0
npm ls | grep "jest"
โโโฌ [email protected]              
โ โโโฌ [email protected]        
โ   โโโ [email protected]                          
โ   โโโฌ [email protected]   
โ   โ โโโ [email protected] deduped            
โ   โ โโโฌ [email protected]                     
โ   โ โ โโโ [email protected] deduped                       
โ   โ โ โโโ [email protected] deduped                       
โ   โ โโโ [email protected] deduped                     
โ   โ โโโฌ [email protected]                        
โ   โ โโโ [email protected] deduped                   
โ   โ โโโฌ [email protected]
โ   โ โโโฌ [email protected]                             
โ   โ โ โโโ [email protected] deduped              
โ   โโโ [email protected] 
โ   โโโฌ [email protected]                      
โ   โ โโโ [email protected]   
โ   โ โโโ [email protected] deduped                         
โ   โโโฌ [email protected]
โ   โ โโโ [email protected] deduped                     
โ   โโโฌ [email protected] 
โ   โ โโโฌ [email protected]   
โ   โ โ โโโ [email protected] deduped              
โ   โ โโโ [email protected] deduped                
โ   โ โโโฌ [email protected]                             
โ   โ โ โโโ [email protected] deduped                       
โ   โ โ โโโ [email protected] deduped              
โ   โ โ โโโ [email protected] deduped               
โ   โ โ โโโ [email protected] deduped                 
โ   โ โโโ [email protected] deduped                 
โ   โ โโโ [email protected] deduped                     
โ   โโโฌ [email protected]                           
โ   โโโ [email protected]                             
โ   โโโฌ [email protected]                   
โ   โ โโโ [email protected] deduped                   
โ   โโโฌ [email protected]  
โ   โ โโโฌ [email protected]  
โ   โ โ โโโฌ [email protected]                       
โ   โ โ   โโโ [email protected]               
โ   โ โโโ [email protected] deduped                       
โ   โ โโโ [email protected] deduped                    
โ   โ โโโ [email protected] deduped                   
โ   โ โโโ [email protected] deduped                      
โ   โ โโโ [email protected] deduped                         
โ   โโโฌ [email protected] 
โ   โ โโโ [email protected] deduped                         
โ   โ โโโ [email protected] deduped                
โ   โ โโโ [email protected] deduped                         
โ   โโโฌ [email protected]     
โ   โ โโโ [email protected] deduped                 
โ   โ โโโ [email protected] deduped                         
โ   โ โโโ [email protected] deduped                     
                    One of the following changes worked for me:
node --inspect-brk node_modules/.bin/jest --watchOpen dedicated DevTools for Node in chrome://inspect.Where did you find these instructions? Or are you trying something specific that you think may work?
If these are instructions, they're incorrect -- we have yet to document them.
Please link me so I may comment on them and correct them. ๐ 
Try this instead:
./node_modules/.bin/react-scripts --inspect-brk test -- --runInBand
                    @0xcaff Running Jest directly (in other projects) works fine for me. I guess it was related to using the different binary path. Also I didn't use Open dedicated DevTools for Node, but that's interesting too.
@Timer I adapted https://github.com/facebook/jest/issues/1652#issuecomment-322834017 for react-scripts thinking it should work (I can't call jest directly because I would be missing CRA support). Unfortunately if I --runInBand, I get an Invalid testPattern error and Babel stops transpiling JSX, which breaks my test suite. If I run it without it, it doesn't stop on my breakpoint (same issue).
I don't think you need extra -- there. It's only needed when you npm test. Try removing it in above command. 
Sorry @nickmccurdy, this should do it:
./node_modules/.bin/react-scripts --inspect-brk test --env=jsdom --runInBand
                    Thanks, it works! I can remove the leading ./ and --env=jsdom which my suite doesn't rely on. I still need to leave --runInBand enabled, which is odd since Jest itself seems to support breakpoints out of band. This works fine for now though.
Should we close this and/or document @Timer's command in the User Guide? Personally I'd rather leave this open until it's documented, though technically my original issue was invalid since it seems I wasn't using the right command anyway.
We need to add a more ergonomic way of running it that doesn't require specifying --runInBand manually and then document it. 
Should we open another issue for that?
That issue already exists :); we can close this. Thanks!
I agree with closing this issue, but where can I find the other issue so I can subscribe?
Most helpful comment
Sorry @nickmccurdy, this should do it: