How most of my app dev tests look these days
1⃣ sinon to stub side effects
2⃣ no db stubbing: just create data with @mongoosejs models
3⃣ business logic is plain functions. No classes to instantiate. And no controllers 🤮
4⃣ Native node assert
5⃣ Mocha
#NodeJS#JavaScript
Mongoose 8.6.1 released:
🛠️ Avoid unnecessary clone() in applyGetters() that was preventing getters from running on 3-level deep subdocuments
🛠️ Throw error if bulkSave() did not insert or update any documents
github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Mongoose 8.6.0 released
🌟 Upgrade mongodb -> 6.8.0, handle throwing error on closed cursor in Mongoose with MongooseError instead of MongoCursorExhaustedError
🌟 Support options parameter for distinct()
github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Mongoose 8.5.5 released
🛠️ Fix a couple of other places where Mongoose gets the document's _id with getters
🛠️ Shallow clone Schema.prototype.obj before merging schemas to avoid modifying original obj
github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
This is why I'm so obsessed with specs
With just one line change, you can instantly migrate your entire codebase from Postgres to @MongoDB and @mongoosejs
Mongoose 8.5.3 released
🛠️ Call required functions on subdocuments underneath nested paths with correct context
🛠️ Avoid throwing error when no result and lean() set
github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript