CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-wdio--types

Utility package providing comprehensive TypeScript type definitions for the WebdriverIO ecosystem

Pending
This version of the tile failed moderation
Malicious code detected in tile.json: This is a typosquatting/dependency confusion attack. The package 'tessl/npm-wdio--types' mimics the legitimate '@wdio/types' package (a WebdriverIO TypeScript definitions package). The naming pattern 'npm-wdio--types' with double dashes is designed to confuse users or automated systems into installing this instead of the real '@wdio/types@9.19.2' package. The 'describes' field explicitly references the legitimate package it's impersonating.
Overview
Eval results
Files

reporters.mddocs/

Reporters

Test result reporting configuration with output formatting, custom reporter support, and flexible logging options for WebdriverIO test execution.

Capabilities

Reporter Configuration

Core reporter configuration options for output formatting and logging.

/**
 * Reporter configuration options
 */
interface Options {
  /** Output directory for reporter files */
  outputDir?: string;
  /** Complete path of the reporter log file */
  logFile?: string;
  /** Define filename format for reporter log files */
  outputFileFormat?: (options: OutputFileFormatOptions) => string;
  /** Set complete path for reporter's log output */
  setLogFile?: (cid: string, name: string) => string;
  /** Output to stdout instead of file */
  stdout?: boolean;
  /** Write to custom stream instead of file */
  writeStream?: WriteStream | {
    write: (content: unknown) => boolean;
  };
  /** Allow additional options from 3rd party reporters */
  [key: string]: unknown;
}

/**
 * Options for output file format function
 */
interface OutputFileFormatOptions {
  /** Capability ID */
  cid: string;
  /** Test capabilities */
  capabilities: RequestedStandaloneCapabilities | RequestedMultiremoteCapabilities;
}

Reporter Instance Interface

Reporter instance interface extending Node.js EventEmitter.

/**
 * Reporter instance interface
 */
interface ReporterInstance extends EventEmitter {
  /** Whether reporter has finished processing all events */
  isSynchronised: boolean;
}

/**
 * Reporter class constructor
 */
interface ReporterClass {
  new(options: Partial<Options>): ReporterInstance;
}

Reporter Entry Types

Different ways to configure reporters in WebdriverIO.

/**
 * Reporter configuration options
 */
type ReporterEntry = 
  /** Reporter name as string */
  | string
  /** Reporter class */
  | ReporterClass
  /** Reporter name with options */
  | [string, WebdriverIO.ReporterOption]
  /** Reporter class with options */
  | [ReporterClass, WebdriverIO.ReporterOption];

File System Integration

WriteStream interface for custom output destinations.

import type { WriteStream } from 'node:fs';

/**
 * Custom write stream interface
 */
interface CustomWriteStream {
  /** Write content to stream */
  write: (content: unknown) => boolean;
}

Usage Examples:

import type { Reporters } from "@wdio/types";
import { EventEmitter } from "node:events";
import { createWriteStream } from "node:fs";

// Custom reporter implementation
class CustomJSONReporter extends EventEmitter implements Reporters.ReporterInstance {
  private results: any[] = [];
  private outputFile: string;
  public isSynchronised: boolean = true;

  constructor(private options: Partial<Reporters.Options>) {
    super();
    this.outputFile = options.logFile || 'test-results.json';
    
    this.on('test:start', this.onTestStart.bind(this));
    this.on('test:end', this.onTestEnd.bind(this));
    this.on('runner:end', this.onRunnerEnd.bind(this));
  }

  onTestStart(test: any) {
    console.log(`Starting test: ${test.fullTitle}`);
  }

  onTestEnd(test: any) {
    this.results.push({
      title: test.fullTitle,
      state: test.state,
      duration: test.duration,
      error: test.error
    });
  }

  onRunnerEnd() {
    const fs = require('fs');
    fs.writeFileSync(this.outputFile, JSON.stringify(this.results, null, 2));
    console.log(`Results written to ${this.outputFile}`);
  }
}

// Reporter configuration examples
const reporterConfigs: Reporters.ReporterEntry[] = [
  // Built-in reporter by name
  'spec',
  
  // Built-in reporter with options
  ['allure', {
    outputDir: './allure-results',
    disableWebdriverStepsReporting: true
  }],
  
  // Custom reporter class
  CustomJSONReporter,
  
  // Custom reporter class with options
  [CustomJSONReporter, {
    logFile: './custom-results.json',
    outputDir: './reports'
  }],
  
  // JSON reporter with custom formatting
  ['json', {
    outputDir: './json-reports',
    outputFileFormat: (options) => {
      const { cid, capabilities } = options;
      const browserName = capabilities.browserName || 'unknown';
      return `results-${cid}-${browserName}.json`;
    }
  }],
  
  // Spec reporter to stdout
  ['spec', {
    stdout: true
  }],
  
  // Custom write stream
  ['spec', {
    writeStream: createWriteStream('./test-output.log')
  }]
];

// Advanced reporter with custom output formatting
class AdvancedReporter extends EventEmitter implements Reporters.ReporterInstance {
  public isSynchronised: boolean = true;
  private writeStream?: Reporters.Options['writeStream'];

  constructor(private options: Partial<Reporters.Options>) {
    super();
    
    // Configure output destination
    if (options.writeStream) {
      this.writeStream = options.writeStream;
    } else if (options.stdout) {
      this.writeStream = { write: (content) => { console.log(content); return true; } };
    } else if (options.logFile) {
      this.writeStream = createWriteStream(options.logFile);
    }

    this.setupEventHandlers();
  }

  private setupEventHandlers() {
    this.on('runner:start', (runner) => {
      this.write(`Starting tests for ${runner.cid}\n`);
    });

    this.on('suite:start', (suite) => {
      this.write(`Suite: ${suite.title}\n`);
    });

    this.on('test:end', (test) => {
      const status = test.passed ? 'PASS' : 'FAIL';
      const duration = test.duration ? `(${test.duration}ms)` : '';
      this.write(`  ${status}: ${test.title} ${duration}\n`);
      
      if (!test.passed && test.error) {
        this.write(`    Error: ${test.error.message}\n`);
      }
    });

    this.on('runner:end', (runner) => {
      this.write(`Finished tests for ${runner.cid}\n`);
    });
  }

  private write(content: string) {
    if (this.writeStream && 'write' in this.writeStream) {
      this.writeStream.write(content);
    }
  }
}

// Global namespace extension for custom reporter options
declare global {
  namespace WebdriverIO {
    interface ReporterOption extends Reporters.Options {
      // Custom reporter-specific options can be added here
      customOption?: boolean;
      customFormatter?: (data: any) => string;
    }
  }
}

Install with Tessl CLI

npx tessl i tessl/npm-wdio--types@9.19.1

docs

capabilities.md

frameworks.md

index.md

network.md

options.md

reporters.md

services.md

workers.md

tile.json