or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli.mdconfiguration.mdindex.mdlaunchers.mdprogrammatic-api.mdreporters.md
tile.json

tessl/npm-testem

Test-framework agnostic JavaScript testing runner that supports TDD workflows and CI integration across multiple browsers and environments.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/testem@3.16.x

To install, run

npx @tessl/cli install tessl/npm-testem@3.16.0

index.mddocs/

Testem

Testem is a test-framework agnostic JavaScript testing runner that makes unit testing easy and enjoyable. It supports running tests across multiple browsers, Node.js, and other environments with both interactive TDD (Test-Driven Development) workflows and automated CI (Continuous Integration) execution.

Package Information

  • Package Name: testem
  • Package Type: npm
  • Language: JavaScript (Node.js)
  • Installation: npm install testem -g

Core Imports

For programmatic usage:

const Api = require('testem/lib/api');
const Config = require('testem/lib/config');

For CLI usage, testem provides a global binary:

testem

Basic Usage

CLI Development Mode (TDD)

# Start interactive development mode
testem

# With specific configuration file
testem -f testem.json

# Launch specific browsers
testem -l Chrome,Firefox

CLI CI Mode

# Run tests in CI mode
testem ci

# With specific reporter
testem ci -R xunit

# Parallel execution
testem ci -P 5

Programmatic API

const Api = require('testem/lib/api');

// Development mode
const api = new Api();
api.startDev({
  port: 7357,
  launch: ['Chrome', 'Firefox']
});

// CI mode
api.startCI({
  reporter: 'tap',
  parallel: 3
}, (exitCode, error) => {
  console.log('Tests completed with exit code:', exitCode);
});

Architecture

Testem is built around several key components:

  • CLI Interface: Commander.js-based command line interface with multiple modes (dev, ci, server, launchers)
  • Configuration System: Flexible configuration via JSON, YAML, or JavaScript files with environment-specific options
  • Launcher System: Pluggable browser and process launchers with built-in support for major browsers
  • Test Runners: Framework-agnostic test execution with support for browser and Node.js environments
  • Reporter System: Multiple output formats (TAP, XUnit, dot, TeamCity) for different integration needs
  • Server Component: Express-based server for serving test files and managing client connections via Socket.IO

Capabilities

Command Line Interface

Complete CLI for development and CI workflows with support for multiple test modes, browser launching, and configuration options.

testem [options]                    # Development mode
testem ci [options]                 # Continuous integration mode
testem server [options]             # Server-only mode
testem launchers                    # List available launchers

Command Line Interface

Configuration Management

Comprehensive configuration system supporting multiple file formats and extensive customization options for test execution, browser launching, and reporting.

// Configuration file formats supported
testem.json      // JSON configuration
testem.yml       // YAML configuration
testem.js        // JavaScript configuration
.testem.json     // Hidden JSON configuration
.testem.yml      // Hidden YAML configuration
.testem.js       // Hidden JavaScript configuration

Configuration

Programmatic API

JavaScript API for integrating testem into build tools, custom workflows, and automated systems.

class Api {
  startDev(options, finalizer): void;
  startCI(options, finalizer): void;
  startServer(options): void;
  restart(): void;
  setDefaultOptions(defaultOptions): void;
}

class Config {
  constructor(appMode, progOptions, config);
  read(callback): void;
  get(key): any;
  set(key, value): void;
}

class Server extends EventEmitter {
  constructor(config);
  start(callback): Promise<void>;
  stop(callback): Promise<void>;
}

Programmatic API

Launcher System

Pluggable system for launching browsers and processes with built-in support for major browsers and custom launcher definitions.

class Launcher {
  constructor(name, settings, config);
  start(): Promise<void>;
  kill(): Promise<void>;
  isProcess(): boolean;
  protocol(): string;
}

class LauncherFactory {
  constructor(name, settings, config);
  create(options): Launcher;
}

Launchers

Test Reporters

Multiple output formats for test results including TAP, XUnit, dot notation, and TeamCity integration.

// Available reporters
const reporters = {
  tap: TapReporter,        // Test Anything Protocol
  xunit: XUnitReporter,    // XUnit XML format
  dot: DotReporter,        // Dot progress indicator
  teamcity: TeamCityReporter, // TeamCity integration
  dev: DevReporter         // Interactive development UI
};

Reporters

Core Types

interface TestemOptions {
  file?: string;              // Configuration file path
  port?: number;              // Server port (default: 7357)
  host?: string;              // Server host (default: localhost)
  launch?: string[];          // Launchers to use
  skip?: string[];            // Launchers to skip
  debug?: boolean | string;   // Debug mode or log file
  test_page?: string | string[]; // Custom test page(s)
  growl?: boolean;            // Enable notifications
  timeout?: number;           // Browser timeout
  parallel?: number;          // Parallel runners (CI mode)
  reporter?: string;          // Test reporter
  bail_on_uncaught_error?: boolean; // Exit on uncaught errors
}

interface ConfigOptions extends TestemOptions {
  framework?: string;         // Test framework (jasmine, qunit, mocha)
  src_files?: string[];       // Source files to include
  src_files_ignore?: string[]; // Files to exclude
  serve_files?: string[];     // Files to serve to browser
  watch_files?: string[];     // Files to watch for changes
  css_files?: string[];       // CSS files to include
  cwd?: string;              // Working directory
  config_dir?: string;       // Config directory
  launchers?: object;        // Custom launcher definitions
  launch_in_dev?: string[];  // Dev mode launchers
  launch_in_ci?: string[];   // CI mode launchers
  routes?: object;           // Custom routes
  proxies?: object;          // Proxy configuration
  middleware?: Function[];   // Express middleware
  browser_args?: object;     // Browser-specific arguments
  browser_paths?: object;    // Custom browser paths
  browser_exes?: object;     // Custom browser executables
}