import type { Helper } from "../helper-registry.js"; /** * Sorts tests by their failure rate in descending order, showing the most unreliable tests first. * * @example * Most Unreliable Tests: * {{#each (sortTestsByFailRate tests)}} * {{this.name}} - Fail Rate: {{this.insights.failRate.current}}% * {{/each}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {Test[]} A sorted array of tests that have a fail rate, from highest to lowest. */ export declare const sortTestsByFailRateHelper: Helper; /** * Sorts tests by their flaky rate in descending order, showing the most flaky tests first. * * @example * Most Flaky Tests: * {{#each (sortTestsByFlakyRate tests)}} * {{this.name}} - Flaky Rate: {{this.insights.flakyRate.current}}% * {{/each}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {Test[]} A sorted array of tests that have a flaky rate, from highest to lowest. */ export declare const sortTestsByFlakyRateHelper: Helper; /** * Filters test results to only include passed tests. * Useful for creating success summaries or filtering out failures. * * @example * Passed Tests: * {{#each (filterPassedTests tests)}} * ✓ {{this.name}} ({{formatDuration this.duration}}) * {{/each}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {Test[]} An array of tests with "passed" status. */ export declare const filterPassedTestsHelper: Helper; /** * Filters test results to only include failed tests. * Useful for creating failure summaries or error reports. * * @example * Failed Tests: * {{#each (filterFailedTests tests)}} * ⊝ {{this.name}} ({{this.message}}) * {{/each}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {Test[]} An array of tests with "failed" status. */ export declare const filterFailedTestsHelper: Helper; /** * Filters test results to only include tests with non-standard statuses (skipped, pending, other). * Useful for creating comprehensive test summaries. * * @example * Other Status Tests: * {{#each (filterOtherTests tests)}} * ⊝ {{this.name}} ({{this.status}}) * {{/each}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {Test[]} An array of tests with non-standard statuses. */ export declare const filterOtherTestsHelper: Helper; /** * Counts the total number of flaky tests in the test results. * * @example * Flaky tests detected: {{countFlakyTests tests}} * {{#if (countFlakyTests tests)}}⚠️{{/if}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {number} The total number of flaky tests. */ export declare const countFlakyTestsHelper: Helper; /** * Determines if there are any flaky tests in the test results. * Useful for conditional rendering of flaky test warnings. * * @example * {{#if (anyFlakyTests tests)}} * ⚠️ Some tests are flaky and may need attention * {{else}} * ✓ No flaky tests detected * {{/if}} * * @param {unknown} tests - An array of Test objects from CTRF report. * @returns {boolean} True if any test is marked as flaky, false otherwise. */ export declare const anyFlakyTestsHelper: Helper; /** * Formats test execution duration from start and stop timestamps into a human-readable format. * Handles edge cases where timing data might be missing or invalid. * * @example * Test Duration: {{formatDurationFromTimes test.start test.stop}} * * * @param {unknown} start - The test start time in milliseconds. * @param {unknown} stop - The test stop time in milliseconds. * @returns {string} A formatted duration string like "1ms", "1.2s", or "1m 30s". */ export declare const formatDurationFromTimesHelper: Helper; /** * Formats a test duration value in milliseconds into a human-readable format. * Perfect for displaying test execution times in reports. * * @example * {{test.name}} completed in {{formatDuration test.duration}} * * * @param {unknown} duration - The test duration in milliseconds. * @returns {string} A formatted duration string like "1ms", "1.2s", or "1m 30s". */ export declare const formatDurationHelper: Helper; /** * Converts ANSI-formatted test messages into HTML and replaces newlines with `
` tags. * Specifically designed for formatting the `test.message` property in CTRF reports. * Ideal for rendering multi-line console messages with colors in a human-friendly HTML format. * This helper formats test messages so they behave well with markdown and regular HTML content. * * @example * {{formatTestMessage test.message}} * Returns: HTML with ANSI colors converted to spans and line breaks as
tags * * {{#if test.message}} *
{{{formatTestMessage test.message}}}
* {{/if}} * * @param {string} text - The test message to format, possibly containing ANSI codes and newlines. * @returns {string} An HTML-formatted string with ANSI codes converted to HTML and line breaks replaced. */ export declare const formatTestMessageHelper: Helper; /** * Similar to `formatTestMessage`, but designed to preserve code formatting more closely. * Converts ANSI to HTML and reduces consecutive newlines, but does not replace them with `
` tags. * Perfect for formatting code blocks, stack traces, and other pre-formatted content in test messages. * This helper is specifically designed to be used in pre code blocks where newlines need to be preserved. * * @example *
{{#if message}}{{formatTestMessagePreCode message}}{{else}}No message available{{/if}}
* * {{formatTestMessagePreCode test.message}} * Returns: HTML with ANSI colors converted but newlines preserved for
 blocks
 *
 * {{#if test.message}}
 *   
{{{formatTestMessagePreCode test.message}}}
* {{/if}} * * @param {unknown} text - The test message to format, possibly containing ANSI codes. * @returns {string} An HTML-formatted string with ANSI codes converted to HTML and consecutive newlines minimized. */ export declare const formatTestMessagePreCodeHelper: Helper; /** * Filters an array of tests to only those that have failed, then limits the result to a specified number. * Perfect for displaying "Top N failed tests" in dashboards and summary reports. * * @example * {{#each (limitFailedTests tests 5)}} *
{{this.name}}
* {{/each}} * * * {{#each (limitFailedTests suite.tests 3)}} * {{this.name}} - {{this.status}} * {{/each}} * * * @param {unknown} tests - An array of Test objects from CTRF report. * @param {unknown} limit - The maximum number of failed tests to return. * @returns {Test[]} An array of failed tests up to the specified limit. * Use to create "Top failed tests" sections in test reports and dashboards. */ export declare const limitFailedTestsHelper: Helper; /** * Retrieves an emoji representation for a given test state or category. * Useful for adding visual flair to CTRF test reports, dashboards, and summaries. * * @example * {{getCtrfEmoji "passed"}} * * * {{getCtrfEmoji "failed"}} * * * {{getCtrfEmoji "flaky"}} * * * {{getCtrfEmoji "build"}} * * * **Use with CTRF templates**: Perfect for creating visually appealing test summaries, status indicators, and dashboard elements that make test reports more engaging and easier to scan. * * @param {unknown} status - The test state or category to get an emoji for. * @returns {string} The emoji corresponding to the test state or category. */ export declare const getCtrfEmojiHelper: Helper; export declare const ctrfHelpers: Helper[];