testing — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited testing (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill helps you run, write, and troubleshoot tests in the DBHub project.
pnpm test # Run all tests (unit + integration)
pnpm test:unit # Unit tests only (no Docker needed)
pnpm test:watch # Interactive watch mode
pnpm test:integration # Integration tests only (requires Docker)Run a specific test file:
pnpm test src/connectors/__tests__/postgres.integration.test.ts
pnpm test src/utils/__tests__/allowed-keywords.test.tsRun tests matching a name pattern:
pnpm test -- --testNamePattern="PostgreSQL"Verbose output for debugging:
pnpm test:integration --reporter=verboseVitest is configured with two projects in vitest.config.ts:
*.test.ts files excluding *integration* in the filename*integration*.test.ts filesThis means the naming convention matters — integration tests MUST have integration in their filename to be correctly categorized.
Unit tests (~20 files, no Docker needed):
src/utils/__tests__/ — Utility function tests (SQL parsing, DSN obfuscation, SSH config, allowed keywords, identifier quoting, parameter mapping, row limiting, safe URL, config watcher, AWS RDS signer)src/tools/__tests__/ — Tool handler tests (execute-sql, search-objects, custom-tool-handler)src/config/__tests__/ — Configuration tests (env parsing, TOML loading)src/connectors/__tests__/ — Connector unit tests (dsn-parser, manager)src/requests/__tests__/ — Request store testsIntegration tests (~11 files, Docker required):
src/connectors/__tests__/postgres.integration.test.tssrc/connectors/__tests__/mysql.integration.test.tssrc/connectors/__tests__/mariadb.integration.test.tssrc/connectors/__tests__/sqlserver.integration.test.tssrc/connectors/__tests__/sqlite.integration.test.tssrc/connectors/__tests__/postgres-ssh.integration.test.tssrc/connectors/__tests__/multi-sqlite-sources.integration.test.tssrc/__tests__/json-rpc-integration.test.tssrc/api/__tests__/sources.integration.test.tssrc/api/__tests__/requests.integration.test.tssrc/config/__tests__/ssh-config-integration.test.tsDatabase connector integration tests extend IntegrationTestBase<TContainer> from src/connectors/__tests__/shared/integration-test-base.ts. This abstract class provides:
beforeAll (120s timeout) → connect → setup test data → run tests → cleanup in afterAllcreateConnectionTests(), createSchemaTests(), createTableTests(), createSQLExecutionTests(), createStoredProcedureTests(), createCommentTests(), createErrorHandlingTests()users table (id, name, email, age) + orders table (id, user_id, amount) + test_schema.productsTo add a new database connector test, extend this class and implement:
createContainer() — Start the Testcontainers instancecreateConnector() — Create the database connectorsetupTestData(connector) — Populate test tablesLocated in src/__fixtures__/:
helpers.ts — Utilities: fixtureTomlPath(), loadFixtureConfig(), setupManagerWithFixture()toml/multi-sqlite.toml — Three in-memory SQLite databases (database_a, database_b, database_c)toml/readonly-maxrows.toml — Sources with readonly/max_rows tool configurationsUsage:
import { setupManagerWithFixture, FIXTURES } from '../../__fixtures__/helpers.js';
const manager = await setupManagerWithFixture(FIXTURES.MULTI_SQLITE);
// ... test ...
await manager.disconnect();Unit tests use vitest mocking:
vi.mock('../../connectors/manager.js'); // Mock ConnectorManager
vi.mocked(ConnectorManager.getCurrentConnector).mockReturnValue(mockConnector);SSH tunnel tests mock SSHTunnel.prototype.establish to avoid real SSH connections while testing config passing.
Integration tests use Testcontainers to run real database instances in Docker.
Before running integration tests:
docker ps| Database | Image | Notes |
|---|---|---|
| PostgreSQL | postgres:15-alpine | Fast startup |
| MySQL | @testcontainers/mysql | Supports IAM auth testing |
| MariaDB | @testcontainers/mariadb | Supports IAM auth testing |
| SQL Server | @testcontainers/mssqlserver | Slow startup (3-5 min), needs 4GB+ RAM |
| SQLite | No container needed | In-memory or file-based |
docker ps # Verify Docker is running
docker system df # Check disk space
docker pull postgres:15-alpine # Manually pull imagesSQL Server containers are the slowest to start (3-5 minutes). Run them separately and ensure Docker has 4GB+ memory:
pnpm test src/connectors/__tests__/sqlserver.integration.test.tsEach integration test manages its own container lifecycle. If containers leak, clean up:
docker ps -a | grep testcontainers # Find leaked containers
docker container prune # Clean up stopped containersThe CI workflow (.github/workflows/run-tests.yml) runs unit and integration tests as separate parallel jobs on PR events. Unit tests don't need Docker; integration tests verify Docker availability first. Check the specific job that failed.
Unit test: Create src/{module}/__tests__/{name}.test.ts — will auto-run with pnpm test:unit.
Integration test: Create src/{module}/__tests__/{name}.integration.test.ts — the integration in the filename is what routes it to pnpm test:integration.
New connector test: Extend IntegrationTestBase, implement the three abstract methods, and call the shared test suite methods.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.