🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@testivai/common

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testivai/common

Shared utilities for TestivAI SDKs and CLI

Source
npmnpm
Version
0.1.19
Version published
Weekly downloads
290
-31.44%
Maintainers
1
Weekly downloads
 
Created
Source

@testivai/common

Shared utilities for TestivAI SDKs and CLI.

Overview

This package contains common functionality used by:

  • @testivai/cli - The TestivAI command-line interface
  • @testivai/witness-playwright - The Playwright SDK

Features

  • Core API Client: HTTP communication with TestivAI Core API
  • Authentication: Credential storage and retrieval
  • Configuration: Loading and parsing testivai.config.ts
  • Types: Shared TypeScript type definitions

Installation

npm install @testivai/common

Usage

import { 
  CoreApiClient, 
  getApiKey, 
  loadConfig,
  TestivaiConfig 
} from '@testivai/common';

// Get API key from environment or stored credentials
const apiKey = getApiKey();

// Create API client
const client = new CoreApiClient(apiKey);

// Validate the API key
const result = await client.validateApiKey();
console.log(result.valid); // true or false

// Load configuration
const config = await loadConfig();
console.log(config.outputDir); // './visual-tests'

API Reference

CoreApiClient

const client = new CoreApiClient(apiKey: string, baseUrl?: string);

// Validate API key
await client.validateApiKey(): Promise<ApiKeyValidationResponse>

// Submit visual check
await client.submitVisualCheck(data: CaptureData): Promise<VisualCheckResult>

// Get test run status
await client.getTestRunStatus(testRunId: string): Promise<VisualCheckResult>

Authentication

// Get API key (from env var or stored credentials)
getApiKey(): string | null

// Check if authenticated
isAuthenticated(): boolean

// Save credentials
saveCredentials(credentials: StoredCredentials): void

// Load credentials
loadCredentials(): StoredCredentials | null

// Delete credentials
deleteCredentials(): void

Configuration

// Load config from file (or return defaults)
await loadConfig(configPath?: string): Promise<TestivaiConfig>

// Check if config file exists
configExists(dir?: string): boolean

// Find config file path
findConfigFile(startDir?: string): string | null

// Get resolved output directory
getOutputDir(config: TestivaiConfig, baseDir?: string): string

License

MIT

Keywords

testivai

FAQs

Package last updated on 22 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts