Saturday 25 August 2018

Node.js TypeScript Boilerplate Without ts-node

I made something for my own projects that I thought might be useful to anyone trying to set up TypeScript for a Node.js project, who doesn't want to use ts-node to run the tests. I understand that using ts-node is subjective, some people might not share my desire to remove it from my build tools. Personally, I found it hard to get consistent code coverage results with Istanbul when I used it. I wanted to create a base setup that compiled the tests and ran them as JavaScript, while still providing me with good code coverage results and the ability to debug both my program source code and test source code in VS Code. This setup achieved those goals for me.https://ift.tt/2wcuMgb you run yarn test (or npm test), the HTML coverage report generated will show the TypeScript source code:​https://ift.tt/2wkvgzO if you use the included VS Code launch configs, the debugging will let you step through the TypeScript. The fact that the TypeScript compiler generates source maps is what enables this. Most other IDEs should be able to be setup to detect the generated source maps as well:​​https://i.redd.it/lwe7wzwxjai11.png​https://i.redd.it/qaannfeyjai11.png

Submitted August 25, 2018 at 08:30PM by welkie

No comments:

Post a Comment