Skip to content
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

Should it debug typescript files ? #214

Closed
DaniGTA opened this issue Jan 8, 2020 · 7 comments · Fixed by #219
Closed

Should it debug typescript files ? #214

DaniGTA opened this issue Jan 8, 2020 · 7 comments · Fixed by #219
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@DaniGTA
Copy link

DaniGTA commented Jan 8, 2020

I try too debug my jest test's but its writen in typescript and with this js debugger it didnt run.
Just stays with 2,9mb ram in the taskmanager and didnt say debugger atteched.

Without this extension the default debugger works. (no changes at the launch config)

Current launch config:


        {
            "name": "Debug Jest Tests",
            "type": "node",
            "request": "launch",
            "runtimeArgs": [
                "--inspect-brk",
                "${workspaceRoot}/node_modules/jest/bin/jest.js",
                "-i",
                "--runInBand"
            ],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "port": 9229
        }
@connor4312
Copy link
Member

connor4312 commented Jan 8, 2020

It should. --inspect-brk may be messing with things--I think with that we might get paused 'invisibly' on the entrypoint. Try removing that and seeing it it solves things.

I think it'd be sensible to strip --inspect-brk from args if we see it, and instead use it to flip on our managed stopOnEntry flag.

If that doesn't solve it, could you share a repo containing your setup so that I could give it a spin?

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Jan 8, 2020
@DaniGTA
Copy link
Author

DaniGTA commented Jan 9, 2020

With --inspect i have the same problem.

Here is the repo with the problem: https://github.com/DaniGTA/listManager just start "Debug Jest Tests"

@connor4312
Copy link
Member

connor4312 commented Jan 9, 2020

Thanks for adding me!

Adjusting your launch config to remove the --inspect flags makes it work--this new debugger boots into inspect mode a little different, and --inspect interferes with that. I think adding a change in this extension to strip out manually-added --inspect flags is appropriate.

Also, fun fact, you no longer need to --runInBand with this adapter, we can automatically attach to and debug in all spawned children 🙂 However right now workers where BPs get hit can run a little slower, so you may want to keep it around.

This launch config should work for you. There are two further issues that will be fixed in tonight's 5PM PST build:

  1. You couldn't previously use pauseForSourceMap: false for transpiled code. We also default pauseForSourceMap to false for Node code, since it will run off disk and we don't need the instrumentation BP which slows things down significantly in the few cases (like Jest) where it can be turned on.
  2. Jest will sometimes break in unexpected locations
        {
            "name": "Debug Jest Tests",
            "type": "pwa-node",
            "request": "launch",
            "trace": true,
            "runtimeArgs": [
                "${workspaceRoot}/node_modules/jest/bin/jest.js",
            ],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
        }

connor4312 added a commit that referenced this issue Jan 9, 2020
I noticed in profiles that this was actually a bottleneck for Jest tests
(in #214) when running as a cluster. I wanted to use a worker thread
for it, but it looks like there's an issue in vscode preventing that[1]
for the moment.

This cuts the time-to-first-breakpoint in half for the jest tests, which
is fairly nice. The child process is killed after 30 seconds of
inactivity. I may do an algorithmic optimization pass on the hash in
the future. In particular, Node/V8 now has native bigint support, which
is almost certainly faster than the `long` library.

1. microsoft/vscode#88386
@connor4312 connor4312 self-assigned this Jan 9, 2020
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jan 9, 2020
@DaniGTA
Copy link
Author

DaniGTA commented Jan 9, 2020

Thanks,
i'm glad the bug was found. 👍

@markm77
Copy link

markm77 commented Jan 11, 2020

FYI I just opened an issue related to Jest having noticed this thread and testing for myself: #222

@connor4312
Copy link
Member

connor4312 commented Jan 30, 2020

Easiest way to verify:

  1. npx create-react-app my-app --template typescript
  2. Set a breakpoint in App.test.tsx
  3. Hit the debug code lens in the package.json and run tests

@alexr00
Copy link
Member

alexr00 commented Jan 31, 2020

Verified this bug, but the package.json code lens left out the npm part of npm react-scripts test and just tried to run react-scripts test. Bug for that #287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants