Registry / testing / karma-time-stats-reporter

karma-time-stats-reporter

JSON →
library0.1.0jsnpmunverified

This Karma plugin, `karma-time-stats-reporter`, provides detailed statistics on test execution times, including a histogram visualization and identification of slow tests. Currently at version 0.1.0, it allows users to configure bin sizes for the histogram, set a threshold for what is considered a 'slow' test, and specify the number of the slowest tests to report. It aims to help developers pinpoint performance bottlenecks in their test suites by offering a granular view of test durations. Its release cadence appears to be infrequent, with its latest update being v0.1.0, indicating a stable but less frequently updated project. Key differentiators include its granular control over time reporting through options like `binSize`, `slowThreshold`, and `reportOnlyBeyondThreshold`, which collectively offer a comprehensive analysis beyond basic pass/fail reporting.

npm install karma-time-stats-reporter
INSTALL
IMPORT
SIG · KARMA-TIME-STATS-R
K
karma-time-stats-reporter
testingjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

time-stats
config.set({ reporters: ['dots', 'time-stats'], // ... });
import { TimeStatsReporter } from 'karma-time-stats-reporter';
Karma reporters are typically referenced by a string identifier in the `karma.conf.js` `reporters` array after installation, not directly imported into application code via `import` or `require`.
timeStatsReporter configuration object
config.set({ timeStatsReporter: { reportTimeStats: true, binSize: 100 } });
const reporterConfig = new TimeStatsReporter();
Configuration for the reporter is provided via the `timeStatsReporter` object directly within the `karma.conf.js` `config.set()` call, not through an instantiated class or separate import.

This configuration snippet for `karma.conf.js` sets up the `karma-time-stats-reporter` to generate a histogram of test times, identify slow tests, and report the top 5 slowest tests, providing detailed insights into test suite performance.

module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine'], // or your preferred framework files: [ 'src/**/*.js', 'test/**/*.js' ], reporters: ['dots', 'time-stats'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false, concurrency: Infinity, // Configuration options for the reporter timeStatsReporter: { reportTimeStats: true, // Print Time Stats (histogram) binSize: 100, // Bin size for histogram (in milliseconds) slowThreshold: 500, // Threshold for a slow test (in milliseconds) reportSlowestTests: true, // Print top slowest tests showSlowTestRankNumber: true, // Displays rank number next to slow tests longestTestsCount: 5, // Number of top slowest tests to list reportOnlyBeyondThreshold: false // Only report tests slower than threshold } }); };
Debug
Known issues
gotchaThis package is currently at version 0.1.0. As a pre-1.0 release, its API surface and configuration options may be subject to non-backward compatible changes in future minor versions.
fix
Regularly check release notes for breaking changes before upgrading, especially for minor version bumps. Consider pinning to a specific patch version if stability is critical.
affects: >=0.0.1
gotchaThe `slowThreshold` option is automatically rounded up to be evenly divisible by `binSize`. This normalization can result in the effective threshold being slightly higher than the explicitly specified value.
fix
When setting `slowThreshold`, consider its relationship to `binSize` and test the resulting behavior. Observe the reporter's output to confirm the actual threshold being applied for slow tests.
affects: >=0.1.0
Errors
Common errors & fixes
Error: No reporter with name "time-stats" found.
The `karma-time-stats-reporter` package is not installed or the `time-stats` identifier is missing from the `reporters` array in `karma.conf.js`.
fix
Ensure the package is installed (`npm install karma-time-stats-reporter --save-dev`) and `time-stats` is correctly added to the `reporters` array in your `karma.conf.js` file: `reporters: ['progress', 'time-stats']`.
TypeError: Cannot read properties of undefined (reading 'reportTimeStats') or similar config-related errors.
The `timeStatsReporter` configuration object is malformed, missing, or placed incorrectly within `karma.conf.js`.
fix
Verify that `timeStatsReporter` is a direct property of the `config.set()` object (i.e., at the top level alongside `reporters`, `browsers`, etc.) and that its properties are correctly named and typed according to the documentation.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
karmarequiredThis is a Karma reporter plugin and requires Karma to function as its test runner environment.
Agent activity
2 hits · last 30 days
node
2
Resources
karma-time-stats-reporter — npm install karma-time-stats-reporter · libregistry