Debugging javascript running in Chrome using VSCode

Installation steps:

  • Install mocha NPM module
  •         npm install
            npm install mocha chai --save-dev
            sudo npm install -g mocha
          
  • Install Debugger for Chrome plugin in VSCode
  • Create a launcher (edit launch.json)
  •       # In this example, the nodejs server is running on port 1337
          # The page to open is mypage.html located in public folder of the workspace
          {
            "version": "0.2.0",
            "configurations": [
              {
                  "name": "chrome debug",
                  "type": "chrome",
                  "request": "launch",
                  "url": "http://localhost:1337/mypage.html",
                  "webRoot": "${workspaceFolder}/public",
                  "smartStep": true
              }
            ]
          }
        
  • Launch the launcher you created
  • Set up breakpoints (breakpoints seems to be lost between lanches)
  • Activate code to debug from button click or other event in web browser

References:


Nexti SA PTY LTD
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.