CtrlK
BlogDocsLog inGet started
Tessl Logo

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

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

console-reporters.mddocs/

Console Reporters

Real-time console output reporters for development and CI environments. Provides immediate feedback during test execution with support for various output formats including TAP protocol, TeamCity integration, and colorized terminal formatting.

Capabilities

TAP Reporter

Outputs Test Anything Protocol (TAP) format to console for standardized test result reporting. TAP is widely supported by testing tools and CI systems.

/**
 * Creates a TAP reporter instance that outputs to console
 * @returns Reporter instance implementing Jasmine reporter interface
 */
function TapReporter(): Reporter;

Usage Examples:

// Basic TAP output to console
const tapReporter = new jasmineReporters.TapReporter();
jasmine.getEnv().addReporter(tapReporter);

TAP Output Format:

TAP version 13
ok 1 - Suite Name : should pass
not ok 2 - Suite Name : should fail
  # Failure: Expected true to be false
  # === STACK TRACE ===
  # Error: Expected true to be false
  #     at Object.<anonymous> (spec.js:10:5)
  # === END STACK TRACE ===
ok 3 - Another Suite : should skip # SKIP disabled by xit or similar
1..3
# 3 specs, 1 failure, 1 skipped, 0 disabled in 0.123s.
# NOTE: disabled specs are usually a result of xdescribe.

TeamCity Reporter

Outputs TeamCity service messages for integration with TeamCity CI/CD platform. Provides real-time test progress and results reporting.

/**
 * Creates a TeamCity reporter instance
 * @param options - Configuration options for TeamCity integration
 * @returns Reporter instance implementing Jasmine reporter interface
 */
function TeamCityReporter(options?: TeamCityOptions): Reporter;

interface TeamCityOptions {
  /** Delegate for modifying suite names when used inside TeamCity messages */
  modifySuiteName?: (fullName: string) => string;
}

Usage Examples:

// Basic TeamCity integration
const teamcityReporter = new jasmineReporters.TeamCityReporter();
jasmine.getEnv().addReporter(teamcityReporter);

// Custom suite name modification
const teamcityReporter = new jasmineReporters.TeamCityReporter({
    modifySuiteName: function(generatedSuiteName) {
        return 'MyProject.' + generatedSuiteName;
    }
});

TeamCity Output Format:

##teamcity[progressStart 'Running Jasmine Tests']
##teamcity[testSuiteStarted name='Suite Name' timestamp='2023-01-01T12:00:00.000']
##teamcity[testStarted name='should pass' captureStandardOutput='true' timestamp='2023-01-01T12:00:00.001']
##teamcity[testFinished name='should pass' timestamp='2023-01-01T12:00:00.002']
##teamcity[testStarted name='should fail' captureStandardOutput='true' timestamp='2023-01-01T12:00:00.003']
##teamcity[testFailed name='should fail' message='Expected true to be false' details='Error stack trace...' timestamp='2023-01-01T12:00:00.125']
##teamcity[testFinished name='should fail' timestamp='2023-01-01T12:00:00.125']
##teamcity[testSuiteFinished name='Suite Name' timestamp='2023-01-01T12:00:00.125']
##teamcity[progressFinish 'Running Jasmine Tests']

Terminal Reporter

Outputs colorized terminal output with configurable verbosity levels for development and build pipeline integration.

/**
 * Creates a terminal reporter instance with configurable output formatting
 * @param options - Configuration options for terminal output
 * @returns Reporter instance implementing Jasmine reporter interface
 */
function TerminalReporter(options?: TerminalOptions): Reporter;

interface TerminalOptions {
  /** Verbosity level 0-3+, higher values show more detail (default: 2) */
  verbosity?: number;
  /** Enable colored output using ANSI escape codes (default: false) */
  color?: boolean;
  /** Show stack traces for failed specs (default: false) */
  showStack?: boolean;
}

Verbosity Levels:

  • 0: Silent (only final summary)
  • 1: Failures only (failed spec names and errors)
  • 2: Progress indicators (dots for passed, F for failed, S for skipped)
  • 3+: Detailed (suite names, individual spec results, timing)

Usage Examples:

// Basic terminal output with default settings
const terminalReporter = new jasmineReporters.TerminalReporter();
jasmine.getEnv().addReporter(terminalReporter);

// Colored output with high verbosity
const terminalReporter = new jasmineReporters.TerminalReporter({
    verbosity: 3,
    color: true,
    showStack: true
});

// Minimal output for CI environments
const terminalReporter = new jasmineReporters.TerminalReporter({
    verbosity: 1,
    color: false,
    showStack: false
});

Terminal Output Examples:

// Verbosity 2 (default)
..F.S
  
Some Suite should fail
    Expected true to be false

SUCCESS: 5 specs, 1 failure, 1 skipped, 0 disabled in 0.123s.

// Verbosity 3 with color
Suite Name
  should pass ... Passed
  should fail ... Failed
    Expected true to be false
    Error: Expected true to be false
        at Object.<anonymous> (spec.js:10:5)
  1 of 2 passed (0 skipped, 0 disabled).

Another Suite  
  should skip ... Skipped
  1 of 1 passed (1 skipped, 0 disabled).

SUCCESS: 3 specs, 1 failure, 1 skipped, 0 disabled in 0.123s.

Color Support

Terminal reporter supports ANSI color codes for enhanced readability.

Color Mapping:

  • Green: Passed specs and success messages
  • Red: Failed specs and error messages
  • Yellow: Disabled specs
  • Cyan: Skipped specs
  • Magenta: Stack trace lines
  • Bold: Suite names and summary text

Reporter Lifecycle Methods

All console reporters implement the complete Jasmine reporter interface.

/** Called when Jasmine starts running */
jasmineStarted(summary?: Summary): void;

/** Called when a test suite starts */
suiteStarted(suite: Suite): void;

/** Called when a test spec starts */
specStarted(spec: Spec): void;

/** Called when a test spec completes */
specDone(spec: Spec): void;

/** Called when a test suite completes */
suiteDone(suite: Suite): void;

/** Called when all tests have completed */
jasmineDone(): void;

Performance Considerations

Output Buffering

  • TAP Reporter: Outputs each spec result immediately
  • TeamCity Reporter: Sends service messages in real-time
  • Terminal Reporter: Buffers output based on verbosity level for better performance

Memory Usage

Console reporters maintain minimal state compared to XML reporters:

  • No file I/O operations
  • Limited internal caching of suite/spec data
  • Immediate output disposal after processing

docs

ci-integration.md

console-reporters.md

index.md

xml-reporters.md

tile.json