Copy
Hey <<First Name>>,

I’ve been digging deep into client work this week. As part of that work, I ran into some issues that required I completely overhaul how the Jest testing framework handles imported modules. I thought this would be a perfect opportunity to add to my “Bending Jest to Our Will” series.

Check out my newest article for a rundown on how to restore Node.js’ normal module import behavior when using Jest.

I’m always on the fence about publishing about things like this. Overriding Jest’s behavior like this is almost certainly a bad idea. The real solution to this problem is to refactor our tests to support Jest’s philosophy of testing, or change to a different test runner like vanilla Jasmine or Mocha. That said, I think there’s some value in showing what’s possible, and the process of finding and implementing these hacks is hopefully interesting to some folks.

What do you think? Is it better to pretend that these kinds of solutions don't exist, and only write about "best practices"?

Pete
Copyright © 2019 East5th, All rights reserved.

Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list