Hello Dear Reader. Last time we spoke about efficient expertise-building. I placed an emphasis on “on-demand” learning, rather than picking things up breadth wise - because unlike Adwaita the Tortoise, I probably won’t live for 256 years and will need to be picky about what it is I study.
With that in mind, let’s see how I did with the goals I set out for myself:
OK, not terrible. I know TypeScript a little better now. Having spent a lot of time in Java-land helped speed up my learning.
The other items I didn’t quite get to. BUT, I did learn some other stuff instead.
The Other Stuff I Learned About
Well, 2 things mainly:
Error Handling in Next.JS
Getting Jest to work with ESM only dependencies is tricky
AKA Dr StrangeTranspile, Or: How I Learned to Stop Worrying and Love the SBOM
1. Error Handling in Next.JS
The way you’re supposed to deal with errors in NextJS depends on whether the errors are:
expected
uncaught
This leads to the following “golden rule”:
In short, an expected error is something that could go wrong that you can conceivably test for. Like, form validation problems, or a dynamic route yielding a dreaded 404.
When this happens, don’t throw an error - return an object that explains the error:
2. Getting Jest to work with ESM only dependencies is tricky
Man, where do I even start with this? I just wanted to get Jest to work with Faker. That’s all I wanted. Turns out, Jest runs in a NodeJS environment where CommonJS is the manner in which modules are modularised. Faker v10, though, has removed CommonJS support entirely, making it ESM-only.
So, in my noobishness, I thought, let me take advantage of the transformIgnorePatterns flag in Jest config. What that does is mark a certain package for transpilation. In my case, I wanted Faker 10’s ESM goodness transpiled to CommonJS for usage with Jest.
Long story short: didn’t work. So, I’m using Faker v9 until… Until I don’t know what.
So, transpilation is strange - and sometimes it just doesn’t seem to work. For now, Faker v9 will remain in my SBOM (Software Bill Of Materials).
That’s all folks…
If you’ve made it this far, thank you, Dear Reader, for being part of my self inflicted journey of erudition. Hopefully you gained something out of this. I sure know that the simple act of writing out these challenges has forced me to reflect on the little bits I’ve learned; it’s helping me learn.
‘Til next time!







