Skip to main content
Glama
credentials.tsโ€ข1.86 kB
/** * Credential validation helper for integration tests */ export interface TestCredentials { baseUrl: string; login: string; token: string; } /** * Check if all required credentials are available */ export function hasValidCredentials(): boolean { return !!( process.env.ZEBRUNNER_URL && process.env.ZEBRUNNER_LOGIN && process.env.ZEBRUNNER_TOKEN ); } /** * Get test credentials from environment variables * Throws an error if credentials are missing */ export function getTestCredentials(): TestCredentials { const baseUrl = process.env.ZEBRUNNER_URL; const login = process.env.ZEBRUNNER_LOGIN; const token = process.env.ZEBRUNNER_TOKEN; if (!baseUrl || !login || !token) { throw new Error( 'โŒ Missing required credentials for integration tests.\n' + 'Please set the following environment variables in your .env file:\n' + ' - ZEBRUNNER_URL\n' + ' - ZEBRUNNER_LOGIN\n' + ' - ZEBRUNNER_TOKEN\n\n' + '๐Ÿ’ก Copy .env.example to .env and configure your Zebrunner credentials' ); } return { baseUrl: baseUrl.replace(/\/+$/, ''), // Remove trailing slashes login, token }; } /** * Skip test if credentials are not available * Use this in test setup for optional integration tests */ export function skipIfNoCredentials(testName: string): void { if (!hasValidCredentials()) { console.log(`โš ๏ธ Skipping ${testName} - no credentials available`); process.exit(0); } } /** * Require credentials or fail fast * Use this in test setup for mandatory integration tests */ export function requireCredentials(testName: string): TestCredentials { try { return getTestCredentials(); } catch (error: any) { console.error(`โŒ ${testName} requires valid credentials:`); console.error(error.message); process.exit(1); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/maksimsarychau/mcp-zebrunner'

If you have feedback or need assistance with the MCP directory API, please join our Discord server