I know there are Run/Debug configurations in WebStorm, but I don't know how to configure the context menu (when I right click in a file, it has Run... and Debug... in the menu, but I can't find where to configure this).
Run configurations are created via Run | Edit Configurations... : press +, choose Node.js, in created configuration specify babel-node as Node Interpreter:
But note that debugging doesn't work well when using it. I'd strongly recommend using -r #babel/register Node.js parameter instead - see comments in https://youtrack.jetbrains.com/issue/WEB-21949
Related
I have four AHK scripts which run on startup, as they have shortcuts placed in my startup folder. How can I make them run as admin?
What I've tried:
I've tried changing their properties to be run as admin, but they just don't run (when I do that).
I've tried changing their shortcuts' properties to be run as admin, but they too just don't run (when I do that).
I've looked at this reddit post on the topic, but I don't know how to implement that code in the scripts.
I've tried creating a basic C++ application which runs them with system("start path\\to\\script"), but it wouldn't compile.
In case it matters, the scripts in question are ahk-active-screenshot, CtrlAlt_Switch.ahk, Kill.ahk, and a modified version of this search script.
You can allow the script to automate administrative programs without running as admin, here're the required steps:
When installing AHK, check the "Add 'Run with UI Access' to context menus" option.
After installation, find AutoHotkeyU64_UIA.exe on your disk.
Open the .ahk script's properties, change the "Open with" option to the AutoHotkeyU64_UIA.exe you just found.
Create a shortcut to this script.
Open %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup in the file explorer.
Move that shortcut to this folder.
And you're done.
How does it work?
The "Add 'Run with UI Access' to context menus" option provides a workaround for common UAC-related issues by allowing the script to automate administrative programs without running as admin.
Reference: Run with UI Access.
Find the UIA version of autohotkey on your machine. For me it is at C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe.
In your startup folder, create a new shortcut (probably one for each of the scripts you want) as follows (replacing paths as appropriate):
Target: "C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe" "D:\path\to\script.ahk"
Start in: "C:\Program Files\AutoHotkey"
This launches your script as an admin using the UIA version of AHK on startup.
How do I set up Cypress debugging in WebStorm? I can get a debugger statement in my code to pause execution in Chrome and debug using devtools, but nothing happens in WebStorm.
This is true whether I am running or debugging my configuration, which is simply npm run cypress (with my cypress open script). When debugging the run configuration, I don't get checkmarks on my breakpoints in WebStorm.
The WebStorm docs refer to selecting your configuration type from the menu but there's no Cypress in the menu.
Is this possible to do?
it is a bit of a process but when you are done it is worth it.
Just a couple notes:
I use it on Mac, Version: 2019.3.2, however it should be very similar.
And (at this time) you have to be running the Chrome browser, you cannot attach to electron.
First, in your package.json file you need to have some npm launch script (not technically necessary, but makes everything else stupid simple) here is a sample of mine:
"scripts": {
"start:ci": "serve --no-clipboard --listen ${PORT:-8080}",
"cypress:open:localhost": "ENV=localhost npm run cypress:open",
"cypress:open:dev": "ENV=dev npm run cypress:open",
"cypress:open:qa": "ENV=qa npm run cypress:open",
"cypress:open:staging": "ENV=staging npm run cypress:open",
"cypress:open:production": "ENV=production npm run cypress:open",
"cypress:open": "cypress open"
},
Next you need to setup a debug configuration for npm. On Mac that is under run->Edit Configurations...
Add a new configuration using the npm template (click the plus and choose npm)
The template will have a drop down for scripts, select your npm script (mine is set for cypress:open:qa) Then click apply.
Now when you launch the debuger it will open your cypress instance with debugging attached to cypress. However, you want to attach to the browser so you can debug your JS.
Start any test in chrome, then open a new tab (in cypress chrome instance) go to the chrome extensions site and add the Jet Brains chrome extension, here is the link:
https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji?hl=en
This will apply it to the chrome version that cypress runs. When you are running your test you right click the JB icon and inspect in WebStorm.
This opens a new tab in your debug dialog box (default bottom left). Open the tab that says scripts in your https://yourproj... tab. Navigate in that dialog to integration file you want to debug, double click it. Slap in a break point and away you go.
There are two plugins that let your run cypress tests from Webstorm. Both let you select a single test and run it then see the result directly in webstorm.
The Pro version allow to debug tests in the cypress runner.
https://plugins.jetbrains.com/plugin/13819-cypress-support (free)
https://plugins.jetbrains.com/plugin/13987-cypress-support-pro (paid)
The pro version debugging capabilities:
You can run cypress as node job in webstorm.
For this:
Set the path to the cypress executable file
Select your folder as working directory
Add run options run --spec cypress/integration/Filters.feature
I am using cucumber so am giving a feature, if you use mocha use your run parameters the same as in the console.
Settings
I would like to add a configuration inside IntelliJ so that I can run it from the Run context menu (there is included Node.JS launcher but I couldn't find a "Command Line configuration launcher")
Also, is it possible to run the command line terminal as Administrator if ran from Windows ?
The command I would like to run is ember serve
Thanks for the help.
These are the steps:
Go to Run/Edit Configurations...
Add a new one for "Javascript Debug"
Fill Name with the name you want for the configuration, fill the URL with http://localhost:4200 and pick the browser you prefer
Then, in the second white box, add an external tool by clicking in the green plus button and selecting the option Run External tool
Add a new one clicking on the green plus button and fill the following fields: in Name the name you want for the external tool, in Program write ember (it's the command you are going to run), in Parameters write server or s as the options for the command and in Working directory write $ProjectFileDir$ if it's not written already to run it in the folder in which you are working with.
With all this, you should only need to press the play button and it should run and open the browser automatically with a tab directing to localhost:4200, where your ember server is running.
EDIT: I'm not using it on windows so I'm not sure if it will run the command as administrator. Probably running Intellij using "Run as Administrator" will do the job.
Is there any way to run external program or command after I open project in WebStorm?
I've created new external tool which runs database server, and after I click on it in menu, it runs the server and everything works, but I'd like to start this tool automatically on project start. And it'd be awesome if it could also open web browser to certain url which would be database admin tool.
If you can launch your desired task using Grunt/Gulp/npm task or any other Run/Debug Configuration then yes -- there is Startup Tasks functionality available at Settings/Preferences | Tools | Startup Tasks.
Note that you cannot execute External Tools entry directly or launch any DOS/shell command this way.
The easiest way of using this would be creating Grunt/Gulp task that would do your actual job. There you can use exec() method to execute custom command.
I developed a Custom application that is able to consume the CRM Web services and perform Windows Live Id authentication, create, read and update operation in the CRM from the custom .NET page. It runs absolutely fine when I debug the application in Visual Studio 2010 but when I deploy the same application and try to authenticate it shows the following error:
"Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
I just wanted to know how to install the Microsoft.IdentityModel assembly using a startup task.I followed some of the steps in the following link:
http://blogs.msdn.com/b/sriharsha/archive/2012/04/07/windows-azure-unable-to-find-assembly-microsoft-identitymodel.aspx
But was unable to add RegisterDLL.cmd to my project solution.
Well,
You can use what Sandrino suggests, but you can also use this powershell script. I use it in couple of project and it works fine. It also auto-recognizes Windows Version (because for Azure Guest OS Family 1.xx you have to use the Windows6.0-xxxxx, and for Guest OS Family 2.xx you have to use Windows6.1-xxx version of the KB update).
You can execute that powershell script in a very simple startup task. Create one setup.cmd file, that you have the following content:
#echo off
powershell -command "Set-ExecutionPolicy Unrestricted" 2>> err.out
powershell .\Install-WIF-OnAzure.ps1 2>> err.out
And run it as simple startup task:
<WebRole name="AzureAndWif" vmsize="Small">
<Startup>
<Task commandLine="setup.cmd" executionContext="elevated" />
</Startup>
...
</WebRole>
Hope this also helps ;)
What do you mean by "was unable to add RegisterDLL.cmd to my project solution"? In Visual Studio, just follow these steps:
Right click on your project
Choose Add > New Item > Text File
Enter the following code (from the blog post):
#echo off
sc config wuauserv start= demand
wusa.exe "Windows6.1-KB974405-x64.msu" /quiet /norestart
sc config wuauserv start= disabled
exit /b 0
Rename the file to RegisterDLL.cmd
In the properties, set Copy to Output Directory to Copy always
Go to File > Save as. On the Save button, click the small arrow and choose Save with Encoding
Choose Unicode (UTF-8 without signature) - Codepage 65001
This should be enough to have a working file. Now follow the rest of the guide and redeploy your application.
If you are deploying this to Windows Azure then make sure "copy local" is set to true on the Microsoft.IdentityModel when you deploy to Azure.
-----------**Update**----------------------------
Cloud Tip #9-Add Microsoft.IdentityModel to the GAC with a Startup Task
http://blogs.msdn.com/b/benko/archive/2012/04/07/cloud-tip-9-add-microsoft-identitymodel-to-the-gac-with-a-startup-task.aspx
This should help...