tdpw
Version:
CLI tool for uploading Playwright test reports to TestDino platform with Azure storage support
139 lines • 4.65 kB
TypeScript
/**
* Environment detection and validation utilities
*/
import { z } from 'zod';
/**
* Environment variable schema with validation
*/
export declare const EnvVarSchema: z.ZodObject<{
NODE_ENV: z.ZodOptional<z.ZodEnum<["development", "staging", "production", "test"]>>;
TESTDINO_API_URL: z.ZodOptional<z.ZodString>;
TESTDINO_TOKEN: z.ZodOptional<z.ZodString>;
TESTDINO_UPLOAD_HTML: z.ZodOptional<z.ZodString>;
TESTDINO_UPLOAD_TRACES: z.ZodOptional<z.ZodString>;
TESTDINO_VERBOSE: z.ZodOptional<z.ZodString>;
LOG_LEVEL: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug", "silent"]>>;
CI: z.ZodOptional<z.ZodString>;
GITHUB_ACTIONS: z.ZodOptional<z.ZodString>;
GITLAB_CI: z.ZodOptional<z.ZodString>;
JENKINS_URL: z.ZodOptional<z.ZodString>;
AZURE_HTTP_USER_AGENT: z.ZodOptional<z.ZodString>;
CIRCLECI: z.ZodOptional<z.ZodString>;
TESTDINO_TIMEOUT: z.ZodOptional<z.ZodString>;
TESTDINO_RETRY_COUNT: z.ZodOptional<z.ZodString>;
TESTDINO_MAX_FILE_SIZE: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
NODE_ENV?: "development" | "staging" | "production" | "test" | undefined;
TESTDINO_API_URL?: string | undefined;
TESTDINO_TOKEN?: string | undefined;
TESTDINO_UPLOAD_HTML?: string | undefined;
TESTDINO_UPLOAD_TRACES?: string | undefined;
TESTDINO_VERBOSE?: string | undefined;
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "silent" | undefined;
CI?: string | undefined;
GITHUB_ACTIONS?: string | undefined;
GITLAB_CI?: string | undefined;
JENKINS_URL?: string | undefined;
AZURE_HTTP_USER_AGENT?: string | undefined;
CIRCLECI?: string | undefined;
TESTDINO_TIMEOUT?: string | undefined;
TESTDINO_RETRY_COUNT?: string | undefined;
TESTDINO_MAX_FILE_SIZE?: string | undefined;
}, {
NODE_ENV?: "development" | "staging" | "production" | "test" | undefined;
TESTDINO_API_URL?: string | undefined;
TESTDINO_TOKEN?: string | undefined;
TESTDINO_UPLOAD_HTML?: string | undefined;
TESTDINO_UPLOAD_TRACES?: string | undefined;
TESTDINO_VERBOSE?: string | undefined;
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "silent" | undefined;
CI?: string | undefined;
GITHUB_ACTIONS?: string | undefined;
GITLAB_CI?: string | undefined;
JENKINS_URL?: string | undefined;
AZURE_HTTP_USER_AGENT?: string | undefined;
CIRCLECI?: string | undefined;
TESTDINO_TIMEOUT?: string | undefined;
TESTDINO_RETRY_COUNT?: string | undefined;
TESTDINO_MAX_FILE_SIZE?: string | undefined;
}>;
export type EnvVars = z.infer<typeof EnvVarSchema>;
/**
* Environment type detection
*/
export declare enum EnvironmentType {
DEVELOPMENT = "development",
STAGING = "staging",
PRODUCTION = "production",
TEST = "test"
}
/**
* CI/CD provider detection
*/
export declare enum CIProvider {
GITHUB_ACTIONS = "github-actions",
GITLAB_CI = "gitlab-ci",
JENKINS = "jenkins",
AZURE_DEVOPS = "azure-devops",
CIRCLECI = "circleci",
UNKNOWN = "unknown"
}
/**
* Environment utilities class
*/
export declare class EnvironmentUtils {
private static envCache;
/**
* Get and validate environment variables with caching
*/
static getEnvironment(): EnvVars;
/**
* Clear environment cache (useful for testing)
*/
static clearCache(): void;
/**
* Detect current environment type
*/
static detectEnvironmentType(): EnvironmentType;
/**
* Detect CI/CD provider
*/
static detectCIProvider(): CIProvider;
/**
* Check if running in CI environment
*/
static isCI(): boolean;
/**
* Check if in development mode
*/
static isDevelopment(): boolean;
/**
* Check if in production mode
*/
static isProduction(): boolean;
/**
* Check if in test mode
*/
static isTest(): boolean;
/**
* Get boolean value from environment variable
*/
static getBooleanEnv(key: keyof EnvVars, defaultValue?: boolean): boolean;
/**
* Get numeric value from environment variable
*/
static getNumberEnv(key: keyof EnvVars, defaultValue: number): number;
/**
* Get string value from environment variable
*/
static getStringEnv(key: keyof EnvVars, defaultValue?: string): string | undefined;
/**
* Validate required environment variables
*/
static validateRequired(requiredVars: Array<keyof EnvVars>): void;
/**
* Get environment summary for debugging
*/
static getEnvironmentSummary(): Record<string, unknown>;
}
//# sourceMappingURL=env.d.ts.map