Testing a TypeScript File Read / Write operations app using Jest JS, Mocks, Unit Tests

preview_player
Показать описание
In this video, I run through how I tested a TypeScript application that reads and writes files to the disk. It's an interesting challenge and results in using jest mocks and the node tmpdir functions.

If you like this video please like and subscribe. I'll be producing more videos in the coming days!

Feel free to donate and help me to buy a coffee or even a new MacBook pro! ;)

BTC: bc1q3fddwnufucdkpqz6fzj03xsskaqjxv8dag90x2
ETH: 0x67cC81389f44c0B980F93dc003300a31aD5dadA2

Many thanks everyone and I appreciate your support in any way!
Рекомендации по теме
Комментарии
Автор

As a TS and Jest user I thank you a lot for making this video! 🙏🏻

dawid_dahl
Автор

Thanks, passed through a lot of videos and only yours worked for me without many imports. Appreciate it

jms
Автор

Awesome explanation. Thank you <3 Greetings from Egypt.

mgehad
Автор

Great video! Like the step wise approach, easy to follow, very well explained!

hkolvoort
Автор

Thank you so much for this! Very helpful.

nairanvac
Автор

Thanks man, You saved me, Greetings from Mexico

Luis-omvc
Автор

8:10. I wrote the test case as shown on this screen. and it throws an error "test/src/mytest.test.ts:1:1 - error TS1208: 'mytest.test.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."

abhishes
Автор

Thanks for the video very informative, as suggestion increase the font size a little bit or maybe don't record the whole screen so it's easier for us to read

carlosdelgado
Автор

I am trying to test my .ts files in an app, but after transpiling to the .js I get an error in the browser: uncaught referenceerror: module is not defined at....
Do you have a solution please???

ragipgashi
Автор

Question. I noticed you didn’t mock the side effecty fs library here, and actually called the real thing, causing real files to be written and read.

I am not aware of the tmpdir from Node os. Is it there for this reason, so that we do not make new actually persisting files every time we run our tests?

dawid_dahl
visit shbcf.ru