{"id":13419,"library":"karma-time-stats-reporter","title":"Karma Test Time Statistics Reporter","description":"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.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/crcatala/karma-time-stats-reporter","tags":["javascript","karma-plugin","karma-reporter"],"install":[{"cmd":"npm install karma-time-stats-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add karma-time-stats-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add karma-time-stats-reporter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This is a Karma reporter plugin and requires Karma to function as its test runner environment.","package":"karma","optional":false}],"imports":[{"note":"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`.","wrong":"import { TimeStatsReporter } from 'karma-time-stats-reporter';","symbol":"time-stats","correct":"config.set({\n  reporters: ['dots', 'time-stats'],\n  // ...\n});"},{"note":"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.","wrong":"const reporterConfig = new TimeStatsReporter();","symbol":"timeStatsReporter configuration object","correct":"config.set({\n  timeStatsReporter: {\n    reportTimeStats: true,\n    binSize: 100\n  }\n});"}],"quickstart":{"code":"module.exports = function(config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine'], // or your preferred framework\n    files: [\n      'src/**/*.js',\n      'test/**/*.js'\n    ],\n    reporters: ['dots', 'time-stats'],\n    port: 9876,\n    colors: true,\n    logLevel: config.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: false,\n    concurrency: Infinity,\n    \n    // Configuration options for the reporter\n    timeStatsReporter: {\n      reportTimeStats: true,           // Print Time Stats (histogram)\n      binSize: 100,                    // Bin size for histogram (in milliseconds)\n      slowThreshold: 500,              // Threshold for a slow test (in milliseconds)\n      reportSlowestTests: true,        // Print top slowest tests\n      showSlowTestRankNumber: true,    // Displays rank number next to slow tests\n      longestTestsCount: 5,            // Number of top slowest tests to list\n      reportOnlyBeyondThreshold: false // Only report tests slower than threshold\n    }\n  });\n};","lang":"javascript","description":"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."},"warnings":[{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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']`.","cause":"The `karma-time-stats-reporter` package is not installed or the `time-stats` identifier is missing from the `reporters` array in `karma.conf.js`.","error":"Error: No reporter with name \"time-stats\" found."},{"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.","cause":"The `timeStatsReporter` configuration object is malformed, missing, or placed incorrectly within `karma.conf.js`.","error":"TypeError: Cannot read properties of undefined (reading 'reportTimeStats') or similar config-related errors."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}