-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Unable to debug jest tests from CRA unless I have run npm run eject first #65793
Comments
That launch config looks correct. There is some fine print on Does it work if you add a |
ah this was my mistake. I had hit enter to trigger a new run, but didn't press a to trigger re-running all tests that hadn't changed. Classic...i spent a good 2 days of messing around on this. I couldn't getting it running with the debugger statement, but pressing a worked for me. |
I guess the only new piece of info for the record was that ejecting the react build seemed to allow my tests to run. it's probably a config issue that is fixed by ejecting the jest config |
@nimms I have similar problem. If i have single test then breakpoint not fire at all. |
Hi Denis
Run your tests with the debug launch config above. Wait for the first test run to finish. Peers enter to trigger a rerun. You’ll then get a message in your console saying that tests weren’t run since there are no changes. Then press a to trigger a full re-run. Took me a while to figure that one. Turns out I’m not great at reading instructions!
nim
… On 2 Jan 2019, at 9:39 am, Denis Strelkov ***@***.***> wrote:
@nimms
I have same problem, what does you mean to 'press a' ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Glad that works for you. I added an extra note to our Jest debug recipe: https://github.com/Microsoft/vscode-recipes/tree/master/debugging-jest-tests#debugging-all-tests |
Am I able to re-open this? My project is back to not working unless I run npm run eject. There's something about the jest setting in the create-react-scripts which doesn't agree with vscode. I can share a repo where this is reproducible. Essentially, I currently can't hit breakpoints in vscode unless I eject the project from react. It's working in webstorm however. |
Yeah please share a repo, thanks. |
Here’s the repo. Just made it public. git@github.com:nimms/gcuh-ed-intranet.git
If you run npm run eject on it, then jest debugging works, otherwise it doesn’t hit the breakpoints.
… On 7 Jan 2019, at 3:50 pm, Rob Lourens ***@***.***> wrote:
Yeah please share a repo, thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#65793 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAADLnFEj-nIorSUYLYNo3ae3HHsK8qZks5vAuAtgaJpZM4ZkV0x>.
|
Thanks for the repo. There is something very strange going on. It seems that the If I downgrade some deps to versions that work in another random project I have sitting around,
then debugging works fine. Gotta file something upstream... |
hmm have just tried downgrading react/dom/scripts to those versions and it doesn't work for me. Thank for looking into it, this has been causing me to tear my hair out. |
Have you successfully debugged the tests using chrome devtools? For me, it only works consistently when running a single test file, whether in chrome devtools or vscode. |
Ok, I'm not insane. That's exactly the problem and it's a bug in Jest that was fixed recently. I guess you just have to wait for that change to come down the pipeline jestjs/jest#7518. You should still be able to debug when running a single file at a time in the meantime. The code makes it look like it should also work when not in 'watch' mode but I don't know how to start it like that. |
Thanks again Rob. |
Creating a new bug request for this because all the other similar ones are closed. Essentially I can't debug jest tests from an create-react-app app unless I run npm run eject first. I've gone through all the previous bug requests, have set -disableOptimisticBPs etc and nothing worked until I finally tried running npm run eject
Steps to Reproduce:
npm run eject
"testEnvironment": "node"
Does this issue occur when all extensions are disabled?: Yes
I have confirmed this occurs in the vs-code insiders build from yesterday also.
The text was updated successfully, but these errors were encountered: