loading...

re: What was your win this week? VIEW POST

FULL DISCUSSION
 

This week, I...

Learned to write better tests for frontend with jest and enzyme and I finished an online course!

heck yeah

 

awesome! this has been bugging me... (heh, get it!?) for a long time.

Got any quick pointers?

 

What I think is a really important theme I kept seeing to keep in mind is when writing tests, focus on behavior not implementation.

It makes sense because implementation can change without really breaking the intended behavior of the UI component.

 

oh man oh man, I love jest. Have you tried using thevscode-jest plugin yet? It's really great for getting quick feedback. In fact, I even thought about adding a section on vscode-jest to my article on "failing fast" but I had already posted it, and I'm trying to make my blog posts "immutable" haha. The past is the past! :)

Philosophical rambling and linking aside... I'd love to hear what's working for you with jest and what you think could be better. I really like talking about testing. .spyOn is my jam. So much better than having to rely on dependency injection.

 

Haven't tried it yet; I try to keep light on the extensions, but I'll check it out thanks!

Yea vscode-jest is definitely not a light extension, but neither is NCrunch which inspired it. But I find that quokka isn’t too bad memory wise.

code of conduct - report abuse