For testing my visual studio code extension I need to open a specific folder.
I've inserted the folder path into the args property of Launch Test Configuration as explained here:
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["${workspaceRoot}/../../RIOT", "--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
"preLaunchTask": "npm: watch"
}
This works fine if I manually open VS Code and start the test with Debug: Start (F5).
But I want to run tests in batch mode with npm test and this does not work.
How to configure the folder under test when using npm test?
Set the folder under test with CODE_TESTS_WORKSPACE environment variable:
> export CODE_TESTS_WORKSPACE=whatever_folder
> npm test
Related
There are two types of configurations in vscode debugging,
Launch via NPM and Launch via npm
I tried but didn't find the docs anywhere
What's the difference between those?
// #launch via NPM
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9229,
"skipFiles": [
"<node_internals>/**"
]
},
// #launch via npm
{
"name": "Launch via NPM",
"request": "launch",
"runtimeArgs": [
"run-script",
"debug"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
}
I get an answer from vscode dev: https://github.com/microsoft/vscode/issues/127232
There is no real difference: the launch config with the "port" attribute is contributed by the legacy node.js debugger and will disappear soon. The second launch config is more recent and comes from js-debug.
Since the legacy debug configurations are automatically redirected to js-debug and since port 9229 is the default debug port anyway, there should be no differences.
I am able to run my Flutter project in an emulator in Android Studio. I'm trying to run that same code in debug mode (f5) in VS Code, but I get an error saying:
Set the 'program' value in your launch config (eg 'lib/main.dart') then launch again.
So I updated my launch config to the following:
{
"version": "0.2.0",
"configurations": [
{
"name": "Dart & Flutter",
"request": "launch",
"type": "dart",
"program": "lib/main.dart"
}
]
}
After that update, when I try f5 I get the following error:
Your launch config references a program that does not exist. If you have problems launching, check the "program" field in your ".vscode/launch.json" file.
I DO have a main.dart file??
Any help would be greatly appreciated.
instead of "program": "lib/main.dart" try "flutterMode": "debug"
{
"version": "0.2.0",
"configurations": [
{
"name": "Dart & Flutter",
"request": "launch",
"type": "dart",
"flutterMode": "debug"
}
]
}
For some reason, VS Code was using the launch config from a different project folder that was in my workspace. After removing that project, f5 worked as expected.
flutter run would help, In my case first run flutter doctor , later do resolve missing configs as mentioned and then Flutter run
I have the following launch task in launch.json:
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/MyProject.dll",
[...]
I would also like to run npm run start:dev, when launching, and terminate it when stopping. So I added this:
{
"command": "npm run start:dev",
"name": "Run npm start:dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/ClientApp",
}
But the latter doesn't do anything. Is it possible to run npm run start:dev upon launch together with an MVC Core app?
I am in the process of switching a project from Gulp 3.9.1 (npm install gulp) to Gulp 4.0 (npm install gulp-4.0.build), but when I do this, Visual Studio Code is no longer able to auto-detect the tasks in my gulpfile.js. In both cases, gulp is installed locally.
My .vscode/tasks.json looks like:
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"showOutput": "always"
}
Looking at the Tasks output, I see the following message:
Running gulp --tasks-simple didn't list any tasks. Did you run npm install?
Can you use Gulp 4.0 with VS Code and have it autodetect the tasks? If so, what steps do I need to follow to get it setup?
Yes, you can use vscode and gulp4.0. I would look at how to upgrade to gulp4.0.
Did you uninstall gulp3.9.1 first?
You should also install gulp4.0 both locally and globally!
Then run
gulp -v
to make sure it worked. vsCode should detect both tasks in your tasks.json file and from your gulpfile.js. You are using the older tasks.json version 0.1.0. Here is an example of a tasks.json file which allows me to type "gulp sync" in the command line from anywhere in the workspaceRoot and run that task:
{
"version": "2.0.0",
"tasks": [
{
"label": "Start server and process files",
"command": "gulp",
"args": [
"sync"
],
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
}
}
]
}
It runs the "sync" task I defined in my gulpfile.js. In fact you can assign a hotkey combo to that such as:
{ "key": "shift+escape",
"command": "workbench.action.tasks.runTask",
"args": "Start server and process files"
},
in your keybindings.json.
I'm trying to debug my node script that is running in Visual Studio Code. My first mistake (apparently) was I pressed the Debug menu choice. It launched the .net debugger (this is actually an asp.net core project) but I wanted to debug just the node server that I launched myself.
Now, when I bring up the terminal windows, the only choice seems to be type powershell (see red arrow).
What I want to do is debug my running node script that I started by typing "node start dev".
{
"version": "0.2.0",
"configurations":
[
{
"name": "node",
"type": "node",
"request": "launch",
"stopOnEntry": false,
"program": "${file}",
"cwd": "${workspaceFolder}",
"args": [
"start", "dev"
]
}
]}