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.

joelanman, to javascript
@joelanman@hachyderm.io avatar

Are Jest and Supertest still the best way to test a Node web app?

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 #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.

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 #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.

oregonmiles, to Humor

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

#humor

danrot, to javascript
@danrot@mastodon.social avatar

👨‍💻 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…

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?

#db
#knexjs
#jest
#mock

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

#testing #webdevelopment

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