1/3/2024 0 Comments Jest webstorm debug![]() The next step is to configure our package.json and nodemon.json files to allow for debugging. You'll notice that I bind port 9229 in my docker-compose.yaml file, this will be very applicable in the next steps so don't forget it! For future comparison, this is what the package.json and nodemon.json files look like in the backend folder before I set up the debugger, Enabling the Debugger in a Typescript ProjectĬool so we're set up with the docker-compose.yaml and Dockerfile and if you run docker-compose up -build you should see the system build and start up. So currently, my docker-compose.yaml and Dockerfile look as follows, You'll also see a devops folder where I keep the docker-compose.yaml file and the Dockerfile that should be used to build the backend code.įinally, I bind the backend/src directory into the docker container so that changes are picked up by nodemon during development and there's a quick project rebuild and restart without having to restart the docker container. I'm using a nest project and I've placed the code into a backend folder. As long as you have docker and docker-compose installed, it should all work! If you'd like to follow in the example, you can clone the GitHub repository. I've used nest as our framework since that's what is most applicable in our use cases. This article outlines how to set up debugging in a Typescript project that runs using docker containers. ![]() The tutorials were great but I couldn't find one that explained the process from start to finish, this article was what I worked off to get to this answer. So I started reading around and found that there are ways to bind to the debug ports for node projects. This means that the current solutions out there won't work for us, unless we want to run half of the stack through docker-compose and the other half directly on our PCs. Furthermore, we use docker-compose, to set up the full stack for local development. We use docker for our development environment to ensure that there is a fast setup. The problem is that that solution assumes we are running the application directly off our PCs. It's pretty straight forward, all you have to do is set up the execution script in Webstorm (or any IDE really) and you're good to go. You're going to have to develop a reproducible case, or send a developer to where I work and you can see it happen.I've recently been looking at how people debug Typescript applications. I can't send you my project and all of its proprietary source code. Then, I go back to step 1 above, rinse and repeat. No matter how many times I stop debugging and start again, the debugger will "fail to connect after timeout" until I kill WebStorm and start it up again. If, at that point, I stop the debugger and try to start debugging again, the debugger will fail to connect. It is as though the breakpoint has actually been hit internally, but the WebStorm UI does not realize it.ģ. Then, at some point, when I start debugging my node.js application, the debugger connects successfully, but when I get to a point where a breakpoint should be hit, the breakpoint does not *appear* to have been hit, but the application I am debugging does not progress either. ![]() ![]() It connects to the debugger successfully and hits breakpoints just fine. I start debugging my node.js application in WebStorm. ![]() Let me describe what happens more completely, since I've experienced the problem so many times I have it memorized.ġ. This will be the reason my team stops using WebStorm. Closing in on two years since reporting this problem, and there has been no progress. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |