Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

testing

БесплатноБез исполняемых скриптовНе проверен

Run and troubleshoot tests for DBHub, including unit tests, integration tests with Testcontainers, and database-specific tests. Use when asked to run tests…

bytebaseот bytebase★ 4 031 звезда на GitHub16 установок в других каталогах

Об этом скилле

Testing Skill

This skill helps you run, write, and troubleshoot tests in the DBHub project.

Test Commands

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)
pnpm test:build        # After `pnpm run build`: import every connector chunk in dist/
pnpm test:mcpb         # After `pnpm run build:mcpb`: smoke-test the packed bundle over stdio

Run a specific test file:

pnpm test src/connectors/__tests__/postgres.integration.test.ts
pnpm test src/utils/__tests__/allowed-keywords.test.ts

Run tests matching a name pattern:

pnpm test -- --testNamePattern="PostgreSQL"

Verbose output for debugging:

pnpm test:integration --reporter=verbose

Test Architecture

Vitest is configured with two projects in vitest.config.ts:

  • unit: All *.test.ts files excluding *integration* in the filename
  • integration: Only *integration*.test.ts files

This means the naming convention matters — integration tests MUST have integration in their filename to be correctly categorized.

Test File Locations

Unit tests (*.test.ts without integration in the name; no Docker needed):

  • src/utils/__tests__/ — Utility function tests (SQL parsing and classification, access policy, row limiting, DSN obfuscation, SafeURL, SQLite DSNs, SSH config and tunnel, identifier quoting, parameter mapping, result columns, query timeouts, config watcher, auth token, cross-origin, AWS RDS signer, …)
  • src/tools/__tests__/ — Tool handler tests (execute-sql, search-objects, explain-sql, health-check, custom-tool-handler, registry, builtin-tools)
  • src/config/__tests__/ — Configuration tests (env parsing, TOML loading)
  • src/connectors/__tests__/ — Connector unit tests (dsn-parser, manager, oracle, clickhouse (against a fake HTTP server), per-connector timeout / auth / pool behaviour, read-only transaction strategy)
  • src/requests/__tests__/ — Request store tests
  • src/__tests__/ — Connector loading and plugin-consistency.test.ts (plugin / bundle / registry manifests stay in step with package.json)

Integration tests (integration in the file name). List them with git ls-files 'src/**/*integration*.test.ts'.

Need Docker (Testcontainers):

  • src/connectors/__tests__/postgres.integration.test.ts
  • src/connectors/__tests__/postgres-ssh.integration.test.ts
  • src/connectors/__tests__/postgres-client-cert.integration.test.ts
  • src/connectors/__tests__/mysql.integration.test.ts
  • src/connectors/__tests__/mariadb.integration.test.ts
  • src/connectors/__tests__/sqlserver.integration.test.ts
  • src/connectors/__tests__/oracle.integration.test.ts
  • src/connectors/__tests__/clickhouse.integration.test.ts

Run without Docker (in-memory SQLite or no database):

  • src/connectors/__tests__/sqlite.integration.test.ts
  • src/connectors/__tests__/multi-sqlite-sources.integration.test.ts
  • src/__tests__/json-rpc-integration.test.ts
  • src/__tests__/http-bind-host.integration.test.ts
  • src/api/__tests__/sources.integration.test.ts
  • src/api/__tests__/requests.integration.test.ts
  • src/config/__tests__/ssh-config-integration.test.ts
  • src/utils/__tests__/tool-metadata.integration.test.ts
  • src/tools/__tests__/builtin-tool-table.integration.test.ts

IntegrationTestBase

Database connector integration tests extend IntegrationTestBase<TContainer> from src/connectors/__tests__/shared/integration-test-base.ts. This abstract class provides:

  • Lifecycle: registerLifecycle() registers the beforeAll (container start, 120s timeout → connect → setup test data) and afterAll (cleanup) hooks
  • Shared test suites: createCommonTests() runs all of createConnectionTests(), createSchemaTests(), createTableTests(), createSQLExecutionTests(), createStoredProcedureTests(), createCommentTests(), createErrorHandlingTests(), createMaxRowsTests() and createReadonlyBackstopTests(); createSSLTests() is opt-in for engines whose container can report session encryption (expectSessionEncryption hook)
  • Dialect hooks: DatabaseTestConfig flags gate the tests an engine cannot run; userLimitedSQL(n) is overridden where the row limit is not LIMIT (SQL Server TOP, Oracle FETCH FIRST)
  • withConnector(config, fn): connects a second connector with the given ConnectorConfig, runs fn, and always disconnects — use it instead of a hand-written connect / try / finally
  • Standard test data: users table (id, name, email, age) + orders table (id, user_id, amount) + test_schema.products

To add a new database connector test, extend this class and implement:

  • createContainer() — Start the Testcontainers instance
  • createConnector() — Create the database connector
  • setupTestData(connector) — Populate test tables

MySQL and MariaDB share

Полный SKILL.md на GitHub

Установить testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл testing?

Run and troubleshoot tests for DBHub, including unit tests, integration tests with Testcontainers, and database-specific tests. Use when asked to run tests, fix test failures, debug integration tests, troubleshoot Docker/database container issues, or add new tests. Also use when verifying code changes work correctly or when CI test failures need investigation.

Как установить скилл testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить testing с