![]() ![]() Now, go into the debugger screen and click the run button: Note that I set the breakpoint on the first line of the test, not the it() call. I can set a breakpoint in the test/stack.ts file right on the it() call for the failing test by clicking in the left margin next to it. vscode/launch.json so you can check this into your source code control for future runs. It contains some “extra” stuff, but the important piece - the registration of ts-node to ensure TypeScript is used - is right at the beginning. For instance, here is my Stack.ts file: /** I write my source files in TypeScript as a module. ![]() I place my code in the src directory and the tests in the test directory, so create those directories. I generally change the license, then add author, description and keywords to mine. Feel free to edit and save the package.json file according to your wishes at this point. ![]() In a terminal window: mkdir ts-algorithms I’ve created a directory on my computer called ts-algorithms. If there is a problem in my code, how can I use the debugger within Visual Studio Code to debug my code?.If I write my code in TypeScript, how can I write and run tests in TypeScript as well?.Rather, this is a blog post to help you practice. If you are studying for an interview or classes, there are plenty of places on the Internet you can go to do that. #Visual studio code debug mocha tests how to#This is not a blog post about how to do data structures and algorithms in TypeScript, JavaScript or any other language. I’ve decided to do my stuff in TypeScript since it’s been a while since I’ve played with TypeScript and I wanted to see what has changed at the same time. I’m spending my July 4th getting back to basics and learning some data structures and algorithms. Debugging tests in the Visual Studio Code debugger.Run TypeScript Mocha Tests in Visual Studio Code ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |