Uh oh!
There was an error while loading. Please reload this page.
🎨 add first class debugging support - #2041
Conversation
bf88ccd to
36244d6Compare36244d6 to
73c8729Compare| var scriptFilename = require.resolve('../scripts/' + script); | ||
| var result = spawn.sync('node', getArgs(scriptFilename), { | ||
| stdio: 'inherit', | ||
| }); |
There was a problem hiding this comment.
it took me a while to figure out what was going on here--the husky git hook lint script kept changing the format out from under me!
There was a problem hiding this comment.
🙈
also, do we not already pass args in via [require.resolve('../scripts/' + script)].concat(args)?
There was a problem hiding this comment.
i dont follow. are you suggesting just passing script to getArgs(...)? that is, getArgs(script), and move that path resolution line into the other file?
There was a problem hiding this comment.
So we already pass arguments through, just not to Node. I didn't realize the flags had to come first, sorry.
They're passed to the script.
There was a problem hiding this comment.
right right right. if desired, we can annotate if you think its fitting somewhere, or rename the fn's to be more communicative
| const DEBUG_FLAGS = [ | ||
| /^debug$/, | ||
| /^--debug$/, | ||
| /^--debug-brk(=\d+)?$/, |
There was a problem hiding this comment.
I believe we shouldn't respect --debug and --debug-brk
are you sure? i'm not convinced we shouldn't support it!
There was a problem hiding this comment.
They're going away in Node 8 iirc.
cdaringe
commented
Apr 29, 2017
back at cha |
This reverts commit 01ab6c9. See jestjs/jest#1652 for more. --inspect isn't honored reliably in jest ATM.
good news! debugging is working reliably! good enough where i think we should ship, after any polish requested is applied. bad news,
|
TheTFo
commented
May 1, 2017
When can we expect a release including this issue? |
cdaringe
commented
May 2, 2017
BTW, I think the build needs to be kicked started again. I don't think my pathes are the source of failure. An extra set of 👀 would be appreciated |
Timer
commented
May 8, 2017
@cdaringe I don't want to leave this hanging, but I don't know if we're going to ship this until jestjs/jest#1652 is resolved. |
gaearon
commented
May 8, 2017
I’m going to push this back to 0.11 so we can have the time to figure this out. |
debug capability, IMHO, is super important, & this is the 2nd time I've implemented it. i'm not upset, but i do not want to have to do it a 3rd time. can you speak more to why you feel we shouldn't get this in sooner? |
caiobalthazar
commented
May 8, 2017
I strongly agree with @cdaringe, this is very important for productivity and one of the worst parts of CRA testing. |
TheTFo
commented
May 9, 2017
via email
I agree, with @cdaringe also. My team needs this capability as soon as
possible. …On Mon, May 8, 2017, 6:35 PM Caio Balthazar ***@***.***> wrote:
I strongly agree with @cdaringe <https://github.com/cdaringe>, this is
very important for productivity and one of the worst parts of CRA testing.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2041 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAgWoPOhKMtJexaWThVfx5D9uuBG-fvlks5r35iUgaJpZM4NLNqS>
.
|
TheTFo
commented
May 25, 2017
jestjs/jest#1652 has been closed with no action taken. |
gaearon
commented
May 25, 2017
There is nothing Jest can do to fix it. Please express your support for nodejs/node#7593. |
gaearon
commented
May 26, 2017
At this point we just need somebody to help push this through. Any volunteers? |
@cdaringe sorry I didn't respond earlier
It's not so much that it's a threat, but if it becomes something we support, it's turns into our job to maintain that feature going forward. Jest doesn't work with This puts us in a bad position because people will expect test debugging to work across all LTS versions of Node (as they should). Secondly, Create React App is a toolchain focused at beginners first, but we still consider advanced users and try to accommodate their needs.
I'm really sorry that you feel your development efforts are being wasted. We will use your work (and not waste it 😄) as a foundation for building out this feature in the future if you are unable to allocate time, but I hope you can understand our position. I would feel comfortable adding support for |
gaearon
commented
May 26, 2017
I think any effort here should be directed towards unblocking Node. Let's just fix it there. |
Timer
commented
May 31, 2017
Just dropping this here, speculation was correct and Really looking forward to nodejs/node#7593 and nodejs/node#9272 (comment) progressing. |
Debugging Jest is still broken. See react/create-react-app#2041
gaearon
commented
Jun 1, 2017
Doesn’t seem like anybody wants to take ownership 😞 . |
cdaringe
commented
Jun 2, 2017
My support hath been cast! |
This and various related issues have been open since fall 2016. It seems like debugging is a second class citizen in the react/jest/CRA community? I know some folks think if tests are so complicated you need to debug them, then you are doing it wrong, but I personally think a debugger (with good tests) is one of the most productivity enhancing tools of all times. It would give me great confidence in the react community if debugging was a first-class concern. For starters, not creating profiles in memory or in an obscure temporary folder would be a good step towards making the transpiled code more obvious. Also, doing things in process vs launching a new process would help considerably. |
Timer
commented
Aug 7, 2017
We'd really like to implement this feature but Node does not support it. See nodejs/node#7593 and nodejs/node#9272 (comment). If you can help implement the feature in Node, that'd be great! |
lifeiscontent
commented
Aug 14, 2017
@Timer can we move forward on this yet now that inspector has been merged in node? |
jgoz
commented
Aug 15, 2017
FYI, debugging Jest tests with inspector is now possible as of Node 8.4.0 (nodejs/node#14465). |
avantgardnerio
commented
Aug 16, 2017
@jgoz Thank you for mentioning that here! I'll upgrade and try it again. I'm very happy to see this fixed! |
gaearon
commented
Aug 16, 2017
No. We were just as frustrated about this. Unfortunately we lacked the necessary knowledge (knowing C, understanding of how contexts work in Node and V8) to fix this. We are also glad the fix has landed! Sometimes a hard fix is just a hard fix, and not some intentional choice. :-) I don't understand what you mean about profiles. |
dchambers
commented
Aug 16, 2017
Can any provide guidance as to how to debug Jest tests using Node.js 8.4.0? I've so far tried: npm test -- --inspect-brkand: node --inspect-brk node_modules/jest/bin/jest.js -iwith no joy. |
cdaringe
commented
Aug 16, 2017
@dchambers, see #594 (comment). make sure you're using version 1.0.11+ |
dchambers
commented
Aug 16, 2017
Thanks @cdaringe, upgrading 'react-scripts' to |
Timer
commented
Sep 29, 2017
Closing this as support has been added in |
TheTFo
commented
Oct 22, 2017
Hey all, I think this is broken. I'm having issues with debugging my thinks. Here's repro branch https://github.com/TheTFo/cria/tree/jest-debug?files=1 Attempt to debug tests from vscode launcher, placing a break point on the line indicated in comment in this file: https://github.com/TheTFo/cria/blob/jest-debug/src/actions/todoActions.js Breakpoints don't appear to hit the appropriate lines. Not sure what's causing it. I don't see transpiled code, just wierd breakpoints hits. |
valoricDe
commented
Nov 14, 2017
@TheTFo had the same problem. Comment #594 (comment) fixed it for me |
continuation of #1360. re-implemented per code review remarks, and conflicts resolved. needs 👀 re-review :).
problem statement
react-scriptsdoes not offer ready-to-roll jest debugging.solution
closes#594
test
/path/to/this/branch/create-react-app/bin/create-react-app dummy-appdummy-appnpm testto add a debug flag ^^npm test