ワンクリックで
testing-guide
Use when working on Vitest configuration, appliance-backed tests, fixtures, or debugging test failures.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when working on Vitest configuration, appliance-backed tests, fixtures, or debugging test failures.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when making Safeguard API calls, wiring auth strategies, or following SDK request and response patterns.
Use when wiring certificate-based A2A retrieval, brokering, or related Safeguard event listeners in Node.js.
Use when changing module structure, auth internals, conditional exports, or the HTTP and storage layers.
Use when changing tsdown config, Azure Pipelines, publishing flow, or version derivation.
| name | testing-guide |
| description | Use when working on Vitest configuration, appliance-backed tests, fixtures, or debugging test failures. |
| trigger | Working on tests, test failures, appliance setup, debugging test output |
tests/unit/ — pure logic only, minimal mockingtests/integration/ — live appliance validationvitest.config.ts (unit), vitest.integration.config.ts (integration)npm run test # Unit tests only
npm run test:watch # Unit tests in watch mode
npm run test:integration # Integration tests (requires env vars)
| Variable | Required | Default | Description |
|---|---|---|---|
SPP_HOST | Yes | — | Appliance hostname. Tests auto-skip when unset. |
SPP_USERNAME | No | Admin | Safeguard user |
SPP_PASSWORD | Yes | — | Password |
SPP_CA_FILE | No | — | CA cert path (omit → verify: false) |
SPP_CERT_FILE | No | — | Client cert for cert auth tests |
SPP_KEY_FILE | No | — | Client key |
SPP_KEY_PASSPHRASE | No | — | Key passphrase |
SPP_A2A_API_KEY | No | — | Pre-configured A2A API key |
SPP_EXTERNAL_PROVIDER | No | — | External auth provider name |
SPP_HOST is unsetUse SgJs_<8hex> prefix for test resources created on the appliance (matches PySafeguard's PySg_ pattern).
getPasswordClient(), getCertClient(), getAnonymousClient()For the rare case where unit testing needs HTTP mocking, use undici's built-in MockAgent:
import { MockAgent, setGlobalDispatcher } from 'undici';
const agent = new MockAgent();
setGlobalDispatcher(agent);
const pool = agent.get('https://appliance.example.com');
pool.intercept({ path: '/RSTS/oauth2/token', method: 'POST' })
.reply(200, { access_token: 'test-token' });