I've tried to debug like descript in docu:
Windows with cmd.exeset PWDEBUG=consolenpm run test
Windows with PowerShell$env:PWDEBUG="console"npm run test
Therefore I've tried in ubuntu:
PWDEBUG=console npm run test
This also doesn't work.
How is the right way to debug in Windows 10?
Next, I've tried the following command in ubuntu:
PWDEBUG=1 npx playwright test
This worked in Ubuntu but not in Windows 10
If you're using visual studio code the default terminal is powershell.
You can open this by going to menu bar: Terminal > New Terminal
If you're not using VS code, just open a new powershell window from the start menu.
You'll know it's powershell as the terminal line start with "PS".
You need to kick off the debugger with two lines. One to turn on the debugger and one to run the tests:
$env:PWDEBUG=1
npx playwright test --headed --browser=chromium
That second lines runs everything as I create this folder with just 1 test file. Refer to the CLI if you want to run a specific tests
VS Code with the terminal window looks like this:
When you run the second line that opens the playwright inspector to allow you to debug:
one liner works for me from VSCode terminal:
set $env:PWDEBUG=1 && npx playwright test --headed --browser=chromium
Related
I am using VSCODE on mac and trying to run a debugger to stop at breakpoints, when running an NPM script.
The NPM script is a shell script (.sh) and it starts a "watcher" on 4 different repos, that form my local server for the project.
The issue is that when I run the debugger on the relevant NPM script (using vscode's 'debug script' option), it seems like VSCODE has a debugger attached, but it never stops at my breakpoints.
The server itself seems to work fine.
I read a lot of answers regarding debugging NPM scripts, but they always refer to a .js file.
Am I not connecting the debugger in the correct way?
Is it possible to debug a shell script that runs this way?
My guess is that the debugger is only connected to the shell script which works fine, but "doesn't know" about the breakpoints in the actual repos that are launched with the script.
Would appreciate any help.
Thank you.
Have installed angular CLI via node js command prompt. However, when I launch terminal in VS code, it doesn't allow to type only. PFA screenshot
PFB terminal setting screenshot
Able to run ng commands from node js command prompt outside vs code.
If your problem is not related to default shell in your terminal. Then you check windows settings. Follow the steps -
Open VSCode file location
Go to Compatibility tab in VSCode properties window
Unchecked Run this program in compatibility mode for: option
see the attached files. Try with this solution, it might help you.
This worked for me:
Remove settings file.
Click on view/terminal.
Select default shell.
I am running my code in Pycharm from Terminal. Is it possible to debug the code and put breakpoints inside the code during a run from terminal?
I don't know anyway to do this through the terminal, but the way I currently do it is:
Run > Edit Configurations > Add new configuration (the green + button)
Choose Python
Fill out Script path, Parameters, and other configuration fields.
Debug the newly added configuration. (Run > Debug...)
With the right configuration the result should be the same as running the script in a terminal.
I find the above process a little tedious. A PEP 553 breakpoint() might be nicer. It requires Python 3.7 and is not implemented yet. See the related issue.
Even if the program is started outside of PyCharm, we can attach PyCharm debugger to it.
Go to Run -> Attach to process.
This will show a list of python process that are currently running on the system. Select the appropriate process from it.
Now PyCharm debugger is connected to that process. We can add breakpoints and debug it.
There is a way using python console.
To run it: Tools -> python console .. or you can find it at the bottom of the IDE.
Then press on 'Attach debugger' line in the following picture:
Add a breakpoint in your code and then pass the file name to the cosole, like: %run my_file.py
Running my Electron app via command-line works fine, but when I double-click the .exe of the packaged app, nothing happens other than my cursor doing a quick "busy" animation. I assume my app is silently crashing.
Is there a way I can get an error message or a crash report from the .exe to help me see what's going on?
From the root of my app directory, both these methods result in my app running fine:
node_modules\.bin\electron.cmd .
electron-packager .
node_modules\.bin\electron.cmd my_app-win32-x64\resources\app
Environment
OS: Windows 10 Anniversary x64
Node: 4.3.1
Npm: 1.14.12
Local electron: 1.4.3
Local and Global electron-packager: 8.1.0
electron-rebuild (for native module "serialport"): 1.2.1
This was not an Electron problem. This was my app trying to access a path relative to process.cwd(), which, when double-clicking the .exe file in the output folder, was not the expected one.
I was able to debug this by running the .exe from the command line, instead of double-clicking the .exe:
my_app-win32-x64\my_app.exe
This causes console.log() output to be visible in the command prompt, which allowed me to finally see the exception that was occurring.
One way to debug such issues is to open a terminal or cmd and drag the exe to it or launch the exe from the terminal or cmd. this will print any uncaught error the app might be throwing.
This can be an issue with paths if you're spawning sub processes - you can use https://github.com/jonluca/node-fix-path to fix the paths on linux and macos
I'm trying to run a web app build process from Visual Studio and I got trouble running my scripts as the executable from the PATH config aren't included in the runned scripts.
Is there a way I can make sure the script is executed in a normal command line process? Or is there a way I can load these executable so they're available in the post/pre build script?
I'm using ruby and node.js in the build process (managed via Grunt). I can get Grunt to run easily by specifying the full absolute path, but then it fails when it tries to access Ruby commands.
So I found a solution working for me, I just launch the command in the cmd.exe process like so:
start cmd /C myCommand
With grunt, the full command can be this if someone is wondering:
start cmd /C %USERPROFILE%\AppData\Roaming\npm\grunt.cmd release --no-color > grunt_output.txt