-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎨 add first class debugging support #2041
Conversation
bf88ccd
to
36244d6
Compare
36244d6
to
73c8729
Compare
var scriptFilename = require.resolve('../scripts/' + script); | ||
var result = spawn.sync('node', getArgs(scriptFilename), { | ||
stdio: 'inherit', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
also, do we not already pass args in via [require.resolve('../scripts/' + script)].concat(args)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're going away in Node 8 iirc.
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,
|
When can we expect a release including this issue? |
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 |
@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. |
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? |
I strongly agree with @cdaringe, this is very important for productivity and one of the worst parts of CRA testing. |
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>
.
|
jestjs/jest#1652 has been closed with no action taken. |
There is nothing Jest can do to fix it. Please express your support for nodejs/node#7593. |
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 |
I think any effort here should be directed towards unblocking Node. Let's just fix it there. |
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 facebook/create-react-app#2041
Doesn’t seem like anybody wants to take ownership 😞 . |
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. |
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! |
@Timer can we move forward on this yet now that inspector has been merged in node? |
FYI, debugging Jest tests with inspector is now possible as of Node 8.4.0 (nodejs/node#14465). |
@jgoz Thank you for mentioning that here! I'll upgrade and try it again. I'm very happy to see this fixed! |
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. |
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-brk and: node --inspect-brk node_modules/jest/bin/jest.js -i with no joy. |
@dchambers, see #594 (comment). make sure you're using version 1.0.11+ |
Thanks @cdaringe, upgrading 'react-scripts' to |
Closing this as support has been added in |
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. |
@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-scripts
does not offer ready-to-roll jest debugging.solution
closes #594
test
/path/to/this/branch/create-react-app/bin/create-react-app dummy-app
dummy-app
npm test
to add a debug flag ^^npm test