or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

ci-integration.mdconsole-reporters.mdindex.mdxml-reporters.md
tile.json

tessl/npm-jasmine-reporters

A collection of JavaScript reporter classes for the Jasmine BDD testing framework that output test results in various formats including JUnit XML, NUnit XML, TAP, TeamCity, AppVeyor, and Terminal

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/jasmine-reporters@2.5.x

To install, run

npx @tessl/cli install tessl/npm-jasmine-reporters@2.5.0

index.mddocs/

Jasmine Reporters

Jasmine Reporters is a collection of JavaScript reporter classes for the Jasmine BDD testing framework. It enables test results to be output in various formats including JUnit XML, NUnit XML, TAP (Test Anything Protocol), TeamCity, AppVeyor, and Terminal formats. The library supports both browser-based and Node.js environments with compatibility for PhantomJS testing scenarios.

Package Information

  • Package Name: jasmine-reporters
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install jasmine-reporters

Core Imports

// Node.js - Import all reporters
const reporters = require('jasmine-reporters');
const junitReporter = new reporters.JUnitXmlReporter(options);
// Browser - Access via global object
const junitReporter = new jasmineReporters.JUnitXmlReporter(options);

Basic Usage

// Node.js usage
const reporters = require('jasmine-reporters');
const junitReporter = new reporters.JUnitXmlReporter({
    savePath: __dirname,
    consolidateAll: false
});
jasmine.getEnv().addReporter(junitReporter);

// Browser usage
const tapReporter = new jasmineReporters.TapReporter();
jasmine.getEnv().addReporter(tapReporter);

// Multiple reporters can be used together
const terminalReporter = new jasmineReporters.TerminalReporter({
    verbosity: 2,
    color: true,
    showStack: true
});
jasmine.getEnv().addReporter(terminalReporter);

Architecture

Jasmine Reporters implements the Jasmine reporter interface with event-driven architecture:

  • Reporter Interface: Each reporter implements standard Jasmine 2.x reporter methods (jasmineStarted, suiteStarted, specStarted, specDone, suiteDone, jasmineDone)
  • File Output: XML reporters support multiple environments (Node.js, PhantomJS) with automatic fallback
  • Universal Module: Works in both CommonJS (Node.js) and browser environments via UMD pattern
  • Event Tracking: Maintains internal state for suites and specs using unique IDs with extend pattern for merging updates

Capabilities

XML Report Generation

File-based reporters that generate structured XML output for CI/CD integration. Includes JUnit and NUnit formats with extensive configuration options.

// JUnit XML Reporter
function JUnitXmlReporter(options?: JUnitOptions): Reporter;

// NUnit XML Reporter  
function NUnitXmlReporter(options?: NUnitOptions): Reporter;

interface JUnitOptions {
  savePath?: string;
  consolidateAll?: boolean;
  consolidate?: boolean; 
  useDotNotation?: boolean;
  useFullTestName?: boolean;
  filePrefix?: string;
  package?: string;
  modifySuiteName?: (fullName: string, suite: Suite) => string;
  modifyReportFileName?: (suggestedName: string, suite: Suite) => string;
  stylesheetPath?: string;
  suppressDisabled?: boolean;
  systemOut?: (spec: Spec, qualifiedName: string) => string;
  captureStdout?: boolean;
}

interface NUnitOptions {
  savePath?: string;
  filename?: string;
  reportName?: string;
}

XML Reporters

Console Output Reporters

Real-time console output reporters for development and CI environments. Includes TAP protocol, TeamCity integration, and terminal formatting.

// TAP Reporter
function TapReporter(): Reporter;

// TeamCity Reporter
function TeamCityReporter(options?: TeamCityOptions): Reporter;

// Terminal Reporter
function TerminalReporter(options?: TerminalOptions): Reporter;

interface TeamCityOptions {
  modifySuiteName?: (fullName: string) => string;
}

interface TerminalOptions {
  verbosity?: number;
  color?: boolean;
  showStack?: boolean;
}

Console Reporters

CI Integration Reporter

Cloud-based CI system integration that posts test results to external APIs during test execution.

// AppVeyor Reporter
function AppVeyorReporter(options?: AppVeyorOptions): Reporter;

interface AppVeyorOptions {
  batchSize?: number;
  verbosity?: number;
  color?: boolean;
}

CI Integration

Common Types

interface Reporter {
  jasmineStarted?(summary?: Summary): void;
  suiteStarted?(suite: Suite): void;
  specStarted?(spec: Spec): void;
  specDone?(spec: Spec): void;
  suiteDone?(suite: Suite): void;
  jasmineDone?(): void;
}

interface Suite {
  id: string;
  description: string;
  fullName: string;
  failedExpectations?: FailedExpectation[];
}

interface Spec {
  id: string;
  description: string;
  fullName: string;
  status: "passed" | "failed" | "pending" | "disabled";
  failedExpectations: FailedExpectation[];
  pendingReason?: string;
}

interface FailedExpectation {
  matcherName?: string;
  message: string;
  stack?: string;
}

interface Summary {
  totalSpecsDefined: number;
}