jasmine-spec-reporter is a console reporter for the Jasmine behavior-driven development framework, providing real-time output of test results directly in the terminal. It is currently stable at version 7.0.0. The latest major release (v7.0.0) was published in April 2021, indicating a slower release cadence in recent years. The library is designed to offer a highly customizable and readable test reporting experience, especially beneficial in Node.js and Protractor test environments, and ships with comprehensive TypeScript type definitions. Key differentiators include extensive configuration options for output formatting, such as support for different stacktrace displays (none, raw, pretty) and customizable color themes for various test states. It offers a more detailed and configurable spec-by-spec breakdown compared to Jasmine's default reporter.
npm install jasmine-spec-reporterVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install and configure `jasmine-spec-reporter` with a minimal Jasmine test suite, showcasing basic options like stacktrace display and color settings.
If extending `CustomReporterResult` in TypeScript, update your interface to reflect the `_jsr` nested property for duration information.
Update custom display processors to use `this.theme.successful('OK ')` instead of `String.prototype` extensions for applying colors.Update your configuration to use `StacktraceOption.PRETTY` (or `RAW`, `NONE`) instead of a boolean value for `displayStacktrace`.
If you have custom `DisplayProcessor` implementations in TypeScript, update method signatures to use `string` instead of `String` (e.g., `log: string` instead of `log: String`).
Ensure you are explicitly calling `jasmine.env.addReporter(new SpecReporter(...))` in your test setup file (e.g., `jasmine.json` helper or `protractor.conf.js`).
Ensure compatible versions of `jasmine-spec-reporter` and `@types/jasmine`. A temporary workaround might be to use a type assertion: `jasmine.env.addReporter(new SpecReporter(...) as any);` or `as jasmine.CustomReporter;`.
Modify your custom `DisplayProcessor` to use the injected `this.theme` object for colorization, e.g., `return this.theme.successful('OK ') + log;`.Add `import { StacktraceOption } from 'jasmine-spec-reporter';` to your file where `SpecReporter` is configured.Change the `displayStacktrace` option in your `SpecReporter` configuration to one of the allowed string values ('none', 'raw', 'pretty') or use the `StacktraceOption` enum (e.g., `displayStacktrace: StacktraceOption.PRETTY`).