Urigo / WhatsApp-Clone-Server

https://www.tortilla.academy/Urigo/WhatsApp-Clone-Tutorial
https://tortilla.academy
451 stars 173 forks source link

Snapshot files are always empty | Stuck on Step 5 - "Testing" #1471

Open matgianesini opened 4 years ago

matgianesini commented 4 years ago

I can't figure out something about jest testing of the server. I'm at Server Step 3.2, and my test passes, and the console also reads "Snapshots: 1 written". The problem is that the file getChats.test.ts.snap gets created but it only ever says "*** Contents:" and nothing else.

To add to my confusion, I downloaded your original repo and git checked out the relevant step, but I encountered the same behavior. Lastly as a sanity check I did a clean clone of the repo, stayed in Master branch, and opened the .snap files in /tests/queries/snapshots. They all say "*** Contents:" and nothing else. Even though looking at the file in the browser, on the same branch, you can see its contents.

matgianesini commented 4 years ago

It turns out everything was working as expected. My only problem was using the program called 'less' for opening and viewing the *.test.ts.snap files. It didn't occur to me that 'less' could be the culprit, as I always use it for quickly viewing files in the command line and had never had any issue.

I still don't know why 'less' is incompatible with these files, but that is out of scope here. So for any other people with terminal based workflows: open snapshot files with VIM or something other than 'less'. Lastly, the program called 'more' does display the file correctly.