npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wdio/native-types

v2.4.0

Published

Type definitions for WebdriverIO Native Desktop Services (Electron and Tauri)

Readme

@wdio/native-types

Type definitions for WebdriverIO Native Desktop Services (Electron and Tauri).

Overview

This package provides comprehensive TypeScript type definitions for WebdriverIO Native Desktop Services, enabling type-safe development when testing Electron and Tauri applications.

Features

Electron Types

Complete type definitions for Electron service integration.

import type {
  ElectronServiceOptions,
  ElectronServiceCapabilities,
  WdioElectronConfig,
  ElectronBrowserExtension
} from '@wdio/native-types';

// Configure Electron service
const config: WdioElectronConfig = {
  capabilities: [{
    browserName: 'electron',
    'wdio:electronServiceOptions': {
      appPath: './dist/main.js',
      appArgs: ['--no-sandbox']
    }
  }]
};

Tauri Types

Full type support for Tauri application testing.

import type {
  TauriServiceOptions,
  TauriServiceCapabilities,
  WdioTauriConfig,
  TauriBrowserExtension
} from '@wdio/native-types';

// Configure Tauri service
const config: WdioTauriConfig = {
  capabilities: [{
    browserName: 'tauri',
    'wdio:tauriServiceOptions': {
      application: './src-tauri/target/release/app'
    }
  }]
};

Mock Types

Type definitions for mocking in desktop application contexts.

import type {
  ElectronMock,
  ElectronFunctionMock,
  TauriMock,
  MockResult,
  ServiceMockContext
} from '@wdio/native-types';

// Type-safe mock usage
const mock: ElectronFunctionMock = fn();
mock.mockReturnValue('mocked result');

// Access typed mock properties
const calls = mock.calls; // Typed call history
const results = mock.results; // Typed call results

Browser Extension Types

Extended WebdriverIO browser interface with native service capabilities.

import type { BrowserExtension } from '@wdio/native-types';

// Browser now includes Electron and Tauri methods
await browser.electronAPI('some-api-call');
await browser.tauriAPI('some-tauri-call');

// Type-safe access to native service capabilities
const electronAPI = browser.electronAPI;
const tauriAPI = browser.tauriAPI;

Package Types

Type definitions for package.json handling.

import type {
  NormalizedPackageJson,
  NormalizedReadResult,
  ReadPackageUpOptions
} from '@wdio/native-types';

const packageInfo: NormalizedReadResult = {
  packageJson: {
    name: 'my-app',
    version: '1.0.0',
    // ... fully typed
  },
  path: '/path/to/package.json'
};

Result Types

Functional programming result types for error handling.

import type { Result } from '@wdio/native-types';

// Type-safe result handling
function divide(a: number, b: number): Result<number, Error> {
  if (b === 0) {
    return { ok: false, error: new Error('Division by zero') };
  }
  return { ok: true, value: a / b };
}

Global Augmentations

This package augments global types for seamless integration:

Window Object

// Electron-specific window properties
window.wdioElectron; // Fully typed Electron API access

WebdriverIO Namespace

// Enhanced browser interface
browser.electronAPI('method'); // Electron-specific methods
browser.tauriAPI('method');   // Tauri-specific methods

// Enhanced capabilities
const capabilities: WebdriverIO.Capabilities = {
  'wdio:electronServiceOptions': { /* ... */ },
  'wdio:tauriServiceOptions': { /* ... */ }
};

Global Variables

// Available in test contexts
fn;           // Mock function from @wdio/native-spy
browser;      // Enhanced WebdriverIO browser
packageJson;  // Current package.json (when available)
__name;       // Function naming utility

API Reference

Electron Types

  • ElectronServiceOptions - Configuration for Electron service
  • ElectronServiceCapabilities - Electron capability definitions
  • ElectronBrowserExtension - Browser methods for Electron
  • ElectronMock - Mock types for Electron contexts
  • WdioElectronConfig - Complete Electron WebdriverIO configuration
  • ElectronInterface - Available Electron APIs
  • ElectronType - Type mappings for Electron APIs

Tauri Types

  • TauriServiceOptions - Configuration for Tauri service
  • TauriServiceCapabilities - Tauri capability definitions
  • TauriBrowserExtension - Browser methods for Tauri
  • TauriMock - Mock types for Tauri contexts
  • WdioTauriConfig - Complete Tauri WebdriverIO configuration
  • TauriAPIs - Available Tauri APIs

Shared Types

  • Result<T, E> - Functional result type
  • MockResult - Mock execution results
  • MockOverride - Mock configuration overrides
  • ServiceMockContext - Mock context for services
  • LogLevel - Logging level definitions
  • Fn - Function type definitions

Package Types

  • NormalizedPackageJson - Standardized package.json structure
  • NormalizedReadResult - Package reading results
  • ReadPackageUpOptions - Options for package reading

Browser Extensions

  • BrowserExtension - Combined Electron + Tauri browser interface

Usage Examples

Complete Electron Configuration

import type { WdioElectronConfig } from '@wdio/native-types';

export const config: WdioElectronConfig = {
  capabilities: [{
    browserName: 'electron',
    'wdio:electronServiceOptions': {
      appPath: './dist/main.js',
      appArgs: ['--dev'],
      env: { NODE_ENV: 'test' }
    }
  }],
  services: [['electron', {
    appPath: './dist/main.js'
  }]]
};

Complete Tauri Configuration

import type { WdioTauriConfig } from '@wdio/native-types';

export const config: WdioTauriConfig = {
  capabilities: [{
    browserName: 'tauri',
    'wdio:tauriServiceOptions': {
      application: './src-tauri/target/release/app',
      tauri: true
    }
  }],
  services: [['tauri', {
    application: './src-tauri/target/release/app'
  }]]
};

Type-Safe Mocking

import type { ElectronFunctionMock } from '@wdio/native-types';
import { fn } from '@wdio/native-spy';

// Fully typed mock
const mock: ElectronFunctionMock = fn();
mock.mockReturnValue('typed result');

expect(mock()).toBe('typed result'); // TypeScript knows return type

Compatibility

  • TypeScript: 5.0+
  • Node.js: 18.12.0+
  • WebdriverIO: 8.0+
  • Electron: 22.0+
  • Tauri: 1.0+

License

MIT