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
npx @tessl/cli install tessl/npm-jasmine-reporters@2.5.0Jasmine 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.
npm install jasmine-reporters// 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);// 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);Jasmine Reporters implements the Jasmine reporter interface with event-driven architecture:
jasmineStarted, suiteStarted, specStarted, specDone, suiteDone, jasmineDone)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;
}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;
}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;
}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;
}