Implementation:Webdriverio Webdriverio BrowserStack Types
| Knowledge Sources | |
|---|---|
| Domains | BrowserStack, Type_Definitions |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
The BrowserStack Types module defines all TypeScript type definitions for the BrowserStack service's configuration, test data structures, and API contracts.
Description
This module provides the core type definitions used throughout the wdio-browserstack-service package. The primary interface BrowserstackConfig defines all service-level configuration options including build identifiers, test observability, Percy, accessibility, local tunnel, session naming, turbo scale, and test orchestration. Supporting interfaces cover test execution data (TestData, TestMeta, CurrentRunInfo), platform metadata (PlatformMeta), API responses (LaunchResponse, AppUploadResponse), crash reporting types, logging types (StdLog, ScreenshotLog, LogData), and funnel instrumentation data structures (FunnelData, EventProperties).
Usage
Import these types whenever you need to interact with the BrowserStack service configuration or handle test data objects. They are used across the service, launcher, reporter, insights handler, accessibility handler, crash reporter, and utility modules.
Code Reference
Source Location
- Repository: Webdriverio_Webdriverio
- File: packages/wdio-browserstack-service/src/types.ts
- Lines: 1-445
Signature
// Primary configuration interface
export interface BrowserstackConfig {
buildIdentifier?: string
testObservability?: boolean
testReporting?: boolean
testObservabilityOptions?: TestObservabilityOptions
testReportingOptions?: TestReportingOptions
percy?: boolean
percyCaptureMode?: string
percyOptions?: { version?: string }
accessibility?: boolean
accessibilityOptions?: { [key: string]: unknown }
app?: string | AppConfig
browserstackLocal?: boolean
forcedStop?: boolean
opts?: Partial<BSOptions>
preferScenarioName?: boolean
sessionNameFormat?: Function
sessionNameOmitTestTitle?: boolean
sessionNamePrependTopLevelSuiteTitle?: boolean
setSessionName?: boolean
setSessionStatus?: boolean
turboScale?: boolean
ipWhiteListing?: boolean
selfHeal?: boolean
testOrchestrationOptions?: TestOrchestrationOptions
}
// Test observability options
export interface TestObservabilityOptions {
buildName?: string
projectName?: string
buildTag?: string[]
user?: string
key?: string
ignoreHooksStatus?: boolean
}
// Test execution data
export interface TestData {
uuid?: string
type?: string
name?: string
scope?: string
scopes?: string[]
identifier?: string
file_name?: string
vc_filepath?: string
location?: string
started_at?: string
finished_at?: string
framework?: string
body?: TestCodeBody
result?: string
failure?: Failure[]
failure_reason?: string
failure_type?: string | null
retries?: { limit: number; attempts: number }
duration_in_ms?: number
integrations?: { [index: string]: IntegrationObject }
hook_type?: string
hooks?: string[]
meta?: TestMeta
tags?: string[]
test_run_id?: string
}
// Current test execution info
export interface CurrentRunInfo {
uuid?: string
name?: string
test?: Frameworks.Test
finished?: boolean
}
Import
import type {
BrowserstackConfig,
BrowserstackOptions,
TestObservabilityOptions,
AppConfig,
TestData,
TestMeta,
CurrentRunInfo,
PlatformMeta,
StdLog,
CBTData,
IntegrationObject,
LaunchResponse,
FunnelData,
EventProperties
} from './types.js'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| N/A | N/A | N/A | This module exports only type definitions; it has no runtime inputs |
Outputs
| Name | Type | Description |
|---|---|---|
| BrowserstackConfig | interface |
Main service configuration interface with all BrowserStack options |
| TestObservabilityOptions | interface |
Test Reporting and Analytics configuration (user, key, buildName, ignoreHooksStatus) |
| TestData | interface |
Complete test run data structure sent to observability APIs |
| CurrentRunInfo | interface |
Lightweight reference to the currently executing test |
| PlatformMeta | interface |
Browser/platform metadata extracted from session capabilities |
| LaunchResponse | interface |
API response from build launch including JWT, build ID, observability/accessibility configs |
| FunnelData | interface |
Funnel instrumentation event data sent to BrowserStack analytics |
Usage Examples
Typing service options
import type { BrowserstackConfig, BrowserstackOptions } from './types.js'
const options: BrowserstackConfig & BrowserstackOptions = {
testObservability: true,
accessibility: true,
setSessionName: true,
setSessionStatus: true,
testObservabilityOptions: {
buildName: 'My Build',
projectName: 'My Project',
ignoreHooksStatus: false
}
}
Using TestData for event dispatch
import type { TestData } from './types.js'
const testData: TestData = {
uuid: uuidv4(),
type: 'test',
name: 'should login successfully',
scope: 'Login Suite - should login successfully',
scopes: ['Login Suite'],
started_at: new Date().toISOString(),
result: 'pending',
framework: 'mocha'
}