원클릭으로
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' });