Our great sponsors
-
javascript-testing-best-practices
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (July 2023)
-
testcontainers-node
Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
I started reading https://github.com/goldbergyoni/javascript-testing-best-practices and thought that this would help change my mindset about tests. Although I feel like I can write better tests, I still feel unmotivated and get tired easily after writing a few unit tests.
I usually do integration tests at first, using testcontainers and load a raw SQL file with mock data at container startup, at integration tests i do http calls to endpoints but not testing any method in specific, and separate to that i do unit tests but only for pure functions that have a business logic. Then use husky and git hooks to run all tests before commits, and on CI run unit tests only.