/** * Refines tests based on applied filters. It is used by the runner to filter out tests that should not be executed. * * @packageDocumentation * @module @pawel-up/lupa/refiner */ import { type Test } from '../testing/test/main.js'; import { Group } from '../testing/group/main.js'; import type { FilteringOptions } from '../types.js'; export { FilteringOptions }; /** * Exposes the API to refine unwanted tests based upon applied * filters. * * @example * const refiner = new Refiner({ tags: ['@slow'] }) * refiner.allows('tags', ['@slow']) // true * refiner.allows('tags', ['@regression']) // false * * const refiner = new Refiner({ tags: [] }) * refiner.allows('tags', ['@slow']) // true * refiner.allows('tags', ['@regression']) // true */ export declare class Refiner { #private; constructor(filters?: FilteringOptions); /** * Enable/disable matching of all tags when filtering tests. * If "matchAll" is enabled, the test tags should match * all the user defined tags. * * Otherwise, any one match will pass the filter * * @param state - Enable or disable matching of all tags * @returns The refiner instance */ matchAllTags(state: boolean): this; /** * Pin a test to be executed. * @param test - The test to pin */ pinTest(test: Test): void; /** * Find if a test is pinned * * @param test - The test to check * @returns True if the test is pinned */ isPinned(test: Test): boolean; /** * Add a filter * * @param layer - The layer to add the filter to * @param values - The values to add to the filter */ add(layer: 'tests' | 'tags' | 'groups', values: string[]): void; /** * Check if refiner allows a specific test or group to run by looking * at the applied filters * * @param testOrGroup - The test or group to check * @returns True if the test or group is allowed to run */ allows(testOrGroup: Test | Group): boolean; }