Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

vscode launch and tasks configuration #121

Open
jednano opened this issue Feb 23, 2018 · 1 comment
Open

vscode launch and tasks configuration #121

jednano opened this issue Feb 23, 2018 · 1 comment

Comments

@jednano
Copy link

jednano commented Feb 23, 2018

Following up on #70 and #46, I'm looking for an ideal vscode setup to debug the application on the back as well as the front end. The "Debug Tests" configuration (shown below) works fine for me, but I'm not really happy with the "Launch Chrome" configuration, because:

  1. Although it works, it requires I first run the npm start task, which opens its own browser window.
  2. I then have to run "Launch Chrome" manually after the fact, leaving me with now 2 open browser windows, only the last of which is attached.

Any way to do this with just one launch configuration?

Note: "preLaunchTask": "start" just hangs and times out.

launch.json

{
   "version": "0.2.0",
   "configurations": [
      {
         "name": "Launch Chrome",
         "type": "chrome",
         "request": "launch",
         "url": "http://localhost:3000",
         "webRoot": "${workspaceRoot}/src",
         "userDataDir": "${workspaceRoot}/.vscode/chrome",
         "sourceMapPathOverrides": {
            "webpack:///src/*": "${webRoot}/*"
         }
      },
      {
        "name": "Debug Tests",
        "type": "node",
        "request": "launch",
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts-ts",
        "args": [
           "test",
          "--runInBand",
          "--no-cache",
          "--env=jsdom"
        ],
        "cwd": "${workspaceRoot}",
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen"
      }
   ]
}

tasks.json

{
   "version": "2.0.0",
   "tasks": [
      {
         "type": "npm",
         "label": "start",
         "script": "start",
         "problemMatcher": []
      },
      {
         "type": "npm",
         "label": "build",
         "script": "build",
         "problemMatcher": [],
         "group": {
            "kind": "build",
            "isDefault": true
         }
      },
      {
         "type": "npm",
         "label": "test",
         "script": "test",
         "problemMatcher": [],
         "group": {
            "kind": "test",
            "isDefault": true
         }
      }
   ]
}
@tsekityam
Copy link

Create a .env file in working directory and set it to

BROWSER=none

then no browser will be opened when npm start.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants