question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CRA2 recommended config hits random break points in VS Code

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

npm --version 6.4.1 yarn --version 1.10.1

Which terms did you search for in User Guide?

“vs code” debugger breakpoints

Environment

  System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  Binaries:
    Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node
    Yarn: 1.10.1 - ~/.nvm/versions/node/v10.10.0/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.10.0/bin/npm
  Browsers:
    Chrome: 69.0.3497.100
    Safari: 12.0
  npmPackages:
    react: ^16.5.2 => 16.5.2 
    react-dom: ^16.5.2 => 16.5.2 
    react-scripts: 2.0.4 => 2.0.4 
  npmGlobalPackages:
    create-react-app: 2.0.2

Steps to Reproduce

  1. Install VS Code 1.27.2 or 1.26.1
  2. npx create-react-app debug-cra2
  3. Add recommended Debug CRA Tests snippet to .vscode/launch.json
  4. Add the snippet below to src/App.test.js
  5. Set breakpoint on line 13 console.log({ foo })
  6. Hit F5 and debug

Snippet for App.test.js

it('should find the breakpoint', () => {
  const foo = 'bar'
  console.log({ foo })
  expect(foo).toBe('bar')
})

it('should find the other breakpoint', () => {
  const foo = 'bar'
  console.log({ foo })
  expect(foo).toBe('bar')
})

Expected Behavior

Execution stops on line 13

Actual Behavior

Execution stops on line 6 or 7, it’s inconsistent.

Reproducible Demo

https://github.com/ryanwmarsh/debug-cra2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:55 (19 by maintainers)

github_iconTop GitHub Comments

13reactions
danielkatzcommented, Mar 14, 2019
"env": { "CI": true },
"disableOptimisticBPs": true

Has solved the problem for me !

Thanks for the solution! For me disableOptimisticBPs: true alone did the trick.

13reactions
johnrazeurcommented, Feb 21, 2019
"env": { "CI": true },
"disableOptimisticBPs": true

Has solved the problem for me !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
Visual Studio Code breakpoint appearing in wrong place
Breakpoints in VSCode were "jumpy" in all my source files. ... My first naive attempt at a debug configuration looked like this:
Read more >
Debug ASP.NET Core Blazor WebAssembly - Microsoft Learn
Hit breakpoints during app startup before the debug proxy is running. ... Configure Visual Studio to launch the browser with the user's ...
Read more >
Manual: Debug C# code in Unity
This is the recommended way to set up Visual Studio for debugging with Unity. ... Breakpoints allow you to specify points in your...
Read more >
VS Code tips — Inline breakpoints - YouTube
Today's VS Code tip: inline breakpointsUse inline breakpoints to break at a specific expression on a line.Potential inline breakpoint ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found