Urgent.News

What's breaking now, across thousands of outlets.

Tech

Integration testing with PostgreSQL, Drizzle and Vitest

For a new TypeScript project I recently had to come up with a concept for integration testing. It was already decided that we will use the following technologies: PostgreSQL as database Drizzle as ORM framework Vitest as testing framework The main question was how to setup a database on which the tests can run. I didn't find much on the topic but the article How to Test Your Node.js & Postgres…

For a new TypeScript project, the author needed to devise a method for integration testing. It was agreed that PostgreSQL, Drizzle, and Vitest would be used as the technologies. The challenge was to set up a database for the tests to run on. The author found an article on testing Node.js and PostgreSQL applications with Drizzle and PGlite, but was unsatisfied with the performance of PGlite.

The article also mentioned Testcontainers but discouraged it due to the overhead of creating throwaway containers. The author then came across an idea of creating throwaway databases in a running PostgreSQL instance, which they followed.

Four approaches were implemented for this purpose:

1. Using PGlite for creating a database for each test file

2. Creating throwaway databases in a running PostgreSQL instance using three different methods

3. Using Testcontainers (discouraged)

4. Using Pglite (preferred)

The author implemented the POCs in a GitHub repository and added unit tests to distinguish them from integration tests. The integration tests ensure that the database is correctly cleaned up between tests. The four approaches are implemented in the repository's ddd folder and branches int-tests-*.

General notes on the usage of Vitest and Drizzle include the use of setupFiles and globalSetup, as well as the use of a function from drizzle-kit to push the schema programmatically. The tests include both integration and unit tests, and ensure that the database is properly cleaned up after each test.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Case Study: The Hidden Observability Tax

Client Profile: A mid-market B2B SaaS platform running a unified commercial observability stack across its production environment.

  • Forensic FinOps audit revealed hidden observability costs exceeding production infrastructure spend
  • Telemetry Vector Pre-Audit Spend Share matrix identified inefficient capabilities not in use
  • Rightsizing observability stack and renegotiating licensing delivered largest cost-reduction

Hands-On with the New Amazon CloudFront Support for AWS Lambda Web Functions

On October 12, 2026, Amazon Web Services introduced support for using AWS Lambda Web Functions as origins for Amazon CloudFront .

  • Lambda Web Functions can serve as CloudFront origins without code changes.
  • CloudFront Origin Access Control restricts Lambda Web Function access.
  • Direct Lambda access returns 403, CloudFront access returns 200.

Your Notification Feed Design Is a Happy Path Fantasy

Your Notification Feed Design Is a Happy Path Fantasy Every frontend system design interview has a moment where the interviewer leans back and says, "Let's design a notification feed." And every…

  • Notification feed design is a challenging task often tested in frontend interviews
  • Six crucial questions, known as breakage checklist, must be answered
  • Proactively addressing breakage points demonstrates robust design understanding

Claves API expuestas en la brecha de OpenCode

Las claves API expuestas en la brecha de OpenCode obligan a revocar hoy mismo las credenciales de OpenAI, Anthropic y Google que muchos desarrolladores guardaron en Console, el servicio en la nube de…

  • API keys of major AI providers exposed due to unauthorized access to a legacy system.
  • Breach reported on October 17, affecting 1.4% of OpenCode's users.
  • OpenCode notified affected users via email and is working with providers to resolve the issue.

More from Sunday 18 October →