What problem does it solve?
This Skill unit addresses the need for clear guidelines and best practices for writing, organizing, and maintaining tests in the opencode-swarm repository, ensuring consistent quality and reliability of the testing process.
Core Features & Use Cases
- Test Writing Guidelines: Provides detailed instructions on how to write tests according to the bun:test framework and bun:test compatibility layer.
- Mock Isolation Rules: Defines critical rules for isolating mocks within the same Bun process to prevent pollution.
- Framework and Mocking: Outlines the use of bun:test for testing and the preferred APIs for mocking to ensure isolation and type safety.
- Mocking Best Practices: Offers best practices for mocking Node built-ins, other application modules, and within the same module.
- Test Isolation Failures: Suggests a protocol for diagnosing and resolving test isolation failures when tests pass individually but fail when run together.
- Two-Tier Mock Convention: Explains the two-tier strategy for mock isolation and a zero-mock testing pattern for file-scoped mocks.
- Mock Module Export Completeness: Ensures that all named exports of the target module are provided when using mock.module().
Quick Start
Load the writing-tests skill to review the guidelines and rules for writing tests in the opencode-swarm repository.