vscode/protractor unbound breakpoints - protractor

I'm trying to debug a Protractor e2e test of an Angular application. I want to start from the e2e test and stop in the application.
I set a breakpoint in the e2e test and one in an Angular component (which should be hit when running the test).
Before launching debug, both breakpoints are bound, but on debug launch the application breakpoint becomes unbound. The e2e breakpoint is hit but not the one in the Angular component.
I've tried to add sourceMap:true in my various tsconfig.json files and in launch configuration, no luck.
I compile from command line (npm run ng serve) which works when I debug e2e tests only or my application only. No .map files are generated.
I want to debug in VSCode, not in Chrome.
Launch configuration:
{
"name": "Launch e2e current file",
"type": "node",
"request": "launch",
"stopOnEntry": false,
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"args": [
"${workspaceRoot}/protractor.conf.js",
"--specs=${file}"
],
"cwd": "${workspaceRoot}",
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/out-tsc-e2e/*.js"
],
"skipSourceMapSupport": true
}
Thank you.
Edit:
Here is a sample project: https://gitlab.com/group11804/project1.git
Run npm ci, npm run start-dev, in VSCode add breakpoints in app.e2e-spec.ts (test1 it()) and AppComponent.onClick() (app.component.ts), select Launch e2e current file launch configuration and hit F5.
Breakpoint in AppComponent.onClick() is not honored, debugger does not stop on it.

Related

Running all Flutter unit tests from Visual Studio Code

In Visual Studio Code, I see no GUI option to run all my Flutter unit tests. I have to individually select each test file, right click, and choose either 'Start debugging' or 'Start without debugging.'
When the emulator is running, I am unable unable to do the above. I cannot run any unit tests from the GUI
My unit tests are located in the test directory and all end in '_test.dart'. To get around both of the above, I can run all the unit tests by doing flutter test from the terminal, but I was wondering if there was a GUI option.
This issue does not exist on Android Studio.
Have you tried this?
https://dartcode.org/releases/v2-21/
{
"name": "All Tests",
"type": "dart",
"request": "launch",
"program": "tests/", // or test/foo for a subset of tests
}

Debug mode does not activate breakpoint

I am trying to use debug mode in my react native application with visual studio code. I am using the command npx react-native run-android. It is activating the react native debugger, but it is not reaching any breakpoint in my application.
I did not find any tutorials to activate debug with npx, so could you guys show me one or explain me what is happening wrongly in this setup?
this is my launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug React Native",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "android",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
},
]
}
An interesting thing it is happening is once it is running the application if I click on the start debugging button my application restarts and it shows a message on debug console:
Launched debug configuration contains 'program' property which is deprecated and will be removed soon. Please replace it with: "cwd": "${workspaceFolder}"
Could not debug. The "path" argument must be of type string. Received type undefined
Since I have not received any answer, I took 3 days to discovered what was happening.
this is the correct configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to packager",
//"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "attach",
"sourceMaps": true,
"cwd": "${workspaceFolder}",
//"outDir": "${workspaceRoot}/.vscode/.react"
},
]
}
Must run the command npx react-native run-android
Once the android emulator is running batch job must be stopped in the terminal
Go to the debug tab in vs code and run the application
ctrl + m on android emulator
click on debug option
Those were the baby steps that I did in order to have the application run in debug mode.

Run Protractor tests with Test Runner UI in Visual Studio Code

I've been using Webstorm for a while and running protractor there is nice and smooth. Now, I was thinking to start using Visual Studio Code for test run. The only thing I am missing is Test Explorer.
So my setup: Protractor 5.4 + TypeScript 3.4 + Jasmine 3.3
I installed Test Explorer UI and Jasmine Test Explorer (1.5.0) and tried setting up launch.json and jasmine.json for it but it simply doesn't show any tests in the Test Explorer.
my jasmine.json that is located in .vscode folder inside project
{
"spec_dir": "${workspaceRoot}/tmp/specs/",
"spec_files": ["*.spec.js"],
"helpers": ["helpers/**/*.js"],
"random": false,
"seed": null,
"stopSpecOnExpectationFailure": false
}
launch.json
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "../node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": ["${workspaceRoot}/protractor.conf.js"],
}
My issue, no tests are shown. I would like to be able to run tests from Test Explorer. Any help is much appreciated.
Just execute webdriver-manager with npx command in your project folder;
npx webdriver-manager update

Visual Studio Code Fails to find WSL

I'm trying to compile some C code in visual studio with gcc using WSL.
I've got a super simple configuration that executes on an F5 Press
"version": "0.2.0",
"configurations": [
{
"name": "Build And Run",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/.vscode/BuildAndRun.bat",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": true,
"environment": [],
},]
Which then should execute the batch file that contains a simple call to wsl and gcc
#echo off
wsl gcc main.c
pause
When I run this bat file by clicking on it, it works and everything compiles. however when I press F5 I get an error that 'wsl' is not recognized as an internal or external command.
I've tried adding it to Path and that didnt help.
I should also add that when I run the command inside the vs terminal it works, which just confuses me even more.
https://code.visualstudio.com/docs/cpp/launch-json-reference
program (required)
Specifies the full path to the executable the debugger will launch or attach to.
The debugger requires this location in order to load debug symbols
program is the executable for debugger to attach, not compile your code. Compile your C program via preLaunchTask in launch.json and config that command in tasks.json. See https://code.visualstudio.com/docs/cpp/config-mingw for reference.
Also, you may need WSL-Remote plugin and work directly in WSL, See also https://code.visualstudio.com/docs/cpp/config-wsl

Testing VS Code extension with npm

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