henrikjernevad, to javascript
@henrikjernevad@mastodon.social avatar

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.

#javascript #typescript #jest

joelanman, to javascript
@joelanman@hachyderm.io avatar

Are Jest and Supertest still the best way to test a Node web app?
#js #node #jest

schizanon, to node

It's been a minute since I wrote a test with ; what's the cool package to use these days?

I think I've used in the past, but there's a package that is suggesting.

https://www.npmjs.com/package/jest-image-snapshot

coderbyheart, to programming
@coderbyheart@chaos.social avatar

I've been removing from our projects at work in favor of the native 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.

twipped, to react
@twipped@twipped.social avatar

We’re doing our semiannual hackathon at work, and for my project I decided to throw myself at making node:test work for so that we can eliminate 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.

oregonmiles, to Humor

...but I . I care for nothing so much as your thoughts.

danrot, to javascript
@danrot@mastodon.social avatar

👨‍💻 I'm building an app with as little 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 . Does it make sense to do for a few lines of JavaScript? How do you handle that? Do you only do in such cases?

💭 I was already thinking about using in , but the is generated by , making it hard to get it in there…

melroy, to programming
@melroy@mastodon.melroy.org avatar

I wrote a new blog article! It's about Bun; the pros and cons, Check it out now:
https://blog.melroy.org/2023/bun-v1.0/

nosherwan, to random
@nosherwan@fosstodon.org avatar

Unit Testing
Jest
Knex.js

I am looking for suggestions for testing knex.js functions in jest.
mocking knex via jest automock still leaves out knex.raw function.

How do you guys test your functions that utilise knex.js?




schizanon, to typescript

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 built with and . There aren't even any functional !

Ten fucking minutes everytime I switch branches!!

joelanman, to javascript
@joelanman@hachyderm.io avatar

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

Tried this: https://github.com/knex/knex/issues/2686#issuecomment-545210690

parcifal, to random
@parcifal@hachyderm.io avatar

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 at the moment should I just learn the framework more? trying to mock everything seems to take me an eternity sometimes.

robrich, to javascript
@robrich@hachyderm.io avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • everett
  • ethstaker
  • thenastyranch
  • magazineikmin
  • modclub
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • JUstTest
  • ngwrru68w68
  • tacticalgear
  • InstantRegret
  • Leos
  • cubers
  • mdbf
  • normalnudes
  • tester
  • GTA5RPClips
  • provamag3
  • cisconetworking
  • anitta
  • lostlight
  • All magazines