I realize it should be possible to connect the IntelliJ debugger to the Node/Grunt process instead of running the tests in a Chrome browser, but as it turned out to be surprisingly tricky for me to get the breakpoints to take effect this Chrome-based solution solved my problem with a lot less fiddling around. The dialog is available only when the Node.js bundled plugin is enabled on the Settings Plugins page as described in Managing plugins. Project run with gulp task runner.I am testing my apis with postman. Javascript and TypeScript, JavaScript Debugger, Node.js - The plugins are available only in IntelliJ IDEA Ultimate, where they are enabled by default. Set breakpoints in javascript or spec files, and run/debug the new configuration config. I am writing back-end for order app in typescript with mongoose database.I am using intellij-IDEA IDE for development. Enable the option to launch the Chrome browser with the IDE debugger when the grunt task is done, opening the _SpecRunner.html file.ħ. It is also possible to add the –filter -flag as an application parameter, to generate a SpecRunner that only runs a subset of the specs.Ħ. Create a new Node Run/Debug configuration in IntelliJ, indicating the project directory as Working directory, the path to the GruntJS install as JavaScript file and the test-task (“jasmine:mytarget:build” in my case) in the Application parameters field. Adding the :build flag/option to the grunt-jasmine task will have it generate a SpecRunner file rather than running the tests.ĥ. js file and add breakpoints in there, I am able to debug that way, but it would be nice to debug directly in TypeScript. Set up a grunt-jasmine task (I also set up a jasmine task, “mytarget”, but that is optional) to generate a _SpecRunner.html template. Using Intellij 2019, System node.exe in Windows, Bundled TypeScript. Get the JetBrains IDE support browser extension from the chrome web store.Ĥ. Make sure NodeJS and Grunt were properly installed and configuredģ. Ideally, I wanted to simply run the debugger from inside my IDE at the click of a button, rather than having to go through a set of manual steps and switching from my IDE context. Uses ExpressJS to demonstrate how to configure NodeJS debugging in WebStorm. The process for debugging javascript/jasmine unit tests have been less straightforward, in part due to our somewhat complicated GruntJS setup. When working on backend code (Java, or whatever) I’d just run the failing test in my IDE using the debugger to inspect the running code. ![]() I have been having a not-so-great time refactoring a piece of JS code recently, breaking existing unit tests in ways I didn’t expect. We also tend to use the Intellij IDEA IDE from JetBrains. We are currently using GruntJS to (amongst other things) run our Jasmine specs / unit tests in PhantomJS as part of our development workflow. Writing unit tests is a thing we do at Aftonbladet, and our front end JavaScript is no exception.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |