Another leak in the JavaScript single-threaded facade (or a bug in Jest, really).
Asserting expect(...).toStrictEqual(...) fails with two structurally identical objects created by two different Node worker threads because their prototypes are not the same (though identical). Asserting expect(structuredClone(...)).toStrictEqual(structuredClone(...)) works.
I've been removing #Jest from our projects at work in favor of the native #NodeJS test runner + tsmatchers if we need more lax object comparison, and I am not missing a thing.
Works much better with native ES modules, and is faster as well.
We’re doing our semiannual hackathon at work, and for my project I decided to throw myself at making node:test work for #react so that we can eliminate #jest from our ecosystem.
A day and a half of solid coding and most of the jest tests I’ve thrown at it are passing! I even got a workable jest.mock replacement in there! Node 20 loaders are really useful!
The one thing that is broken is that for some reason react contexts don’t work, and I have no damn clue why.
👨💻 I'm building an app with as little #JavaScript as possible (only sending and receiving push notifications). I don't use any framework, and everything else is handled by the server.
❓ Now I'm wondering how to handle #testing. Does it make sense to do #UnitTesting for a few lines of JavaScript? How do you handle that? Do you only do #E2ETesting in such cases?
💭 I was already thinking about using #JSDom in #Jest, but the #HTML is generated by #Symfony, making it hard to get it in there…
The project I get paid to work on takes > ten minutes to install, build, and test from a fresh repo. That's not hyperbole. It's just two #websites built with #typescript#nextJS#yarn#nixOS and #jest. There aren't even any #e2e functional #tests!
anyone got experience closing a db connection after all Jest tests using Knex? Nothing I'm trying works, it just hangs unless I use forceExit which I'd rather not
Do you have any tips on writing unit tests? How does one get better at making unit tests? or testing in general? seems like such a pain in the caboose I am using #jest at the moment should I just learn the framework more? trying to mock everything seems to take me an eternity sometimes.