Configure Jest - TypeScript - Node.js - Express - No commentary
If you are a TypeScript developer on the backend side, you need to write unit tests in a daily basis. One of the most popular library for doing unit tests in the Node.js ecosystem is Jest. It's a pretty decent solution, but it has not an easy configuration curve therefore I made this short example to make it simple for you. Non-TypeScripted version: https://youtu.be/-eBrrLsxHHQ 0:00 - Start 1:20 - Create project and install dependencies 1:35 - Define npm commands 2:26 - TypeScript configuration file 3:35 - Create application 4:28 - Jest configuration file 5:33 - Create endpoint / route 7:10 - Add first test suit and test case 11:22 - First attempt to run tests - failed 11:37 - Fix Jest configuration file - wrong testMatch pattern 11:56 - Second attempt to run tests - green result 12:04 - Run test coverage 12:20 - Try to use application endpoint - application doesn't run 12:33 - Start application - try to call endpoint again - 404 12:45 - Add endpoint to the application 12:57 - Call endpoint - success 13:06 - Final test runs TypeScript: https://www.typescriptlang.org/ Jest: https://jestjs.io/ Express.js: https://expressjs.com/ Node.js: https://nodejs.org/en/ Source code: https://github.com/davidcsejtei/jest-express-ts-example Udemy profile: https://www.udemy.com/user/david-csej... LinkedIn profile: https://www.linkedin.com/in/davidcsej... Medium profile: https://codinglikedavid.medium.com/ 🚀 Join my slack group to get help: https://join.slack.com/t/codinglikedavid/shared_invite/zt-wowi9q4g-0N_ngfSx0dcOUMaRftdylQ
Download
0 formatsNo download links available.