testing

Codify unit and integration test types with in-memory Postgres and ClickHouse databases.

4.6k|378|Updated Jun 28, 2024
One-click install
npx skills add https://github.com/latitude-dev/latitude-llm --skill testing-latitude-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/latitude-dev/latitude-llm/tree/main/.agents/skills/testing
Command: npx skills add https://github.com/latitude-dev/latitude-llm --skill testing-latitude-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps teams implement consistent testing practices by codifying when to use unit, integration, and end-to-end tests, and by clarifying how to test with in-memory databases to keep production code clean.

Core Features & Use Cases

  • Establishes clear test type guidelines (unit, integration, end-to-end) and naming conventions for test suites.
  • Provides in-memory database testing strategies, including Postgres via PGlite and ClickHouse via chdb, for deterministic results.
  • Explains how to expose test helpers via a dedicated /testing path to avoid leaking test code into production bundles.

Quick Start

Set up a new testing project using the conventions and write a basic unit test and an integration test against the in-memory databases.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up in-memory Postgres and ClickHouse for Node integration tests?

Set up in-memory Postgres using PGlite and ClickHouse using chdb to achieve deterministic integration testing. This approach provides fast, isolated database environments for Node-based services without requiring external database connections.

When should I use unit tests versus integration tests in a Node service?

Use unit tests for isolated logic and integration tests when verifying database interactions. Clear test categorization guidelines and naming conventions help standardize testing practices, ensuring you apply the correct test type at the right stage.

How do I export test helpers without leaking test code into production bundles?

Export test helpers via a dedicated /testing path to prevent leaking test code into production. This strategy ensures safe, isolated test utilities are available as production-ready exports without bloating the main application bundle.

What is the best way to standardize testing practices across a software team?

Standardize testing practices by codifying test types and environment setups. Establish clear guidelines for unit, integration, and end-to-end tests, along with naming conventions, to ensure consistent and reliable software testing.

Does vitest work with in-memory databases for deterministic test results?

Yes, vitest works with in-memory databases. You can leverage PGlite for Postgres and chdb for ClickHouse within your vitest test suites to achieve fast, deterministic integration test results in Node-based environments.

Why do my integration tests fail when running against external databases?

Integration tests fail due to external database state and network latency. Using in-memory databases like PGlite and chdb eliminates these dependencies, providing deterministic results and isolating test environments from external factors.