Skip to content

Lupa API Reference / @pawel-up/lupa/refiner / Refiner

Class: Refiner

Defined in: src/refiner/main.ts:36

Exposes the API to refine unwanted tests based upon applied filters.

Example

ts
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

Constructors

Constructor

new Refiner(filters?): Refiner

Defined in: src/refiner/main.ts:60

Parameters

filters?

FilteringOptions = {}

Returns

Refiner

Methods

add()

add(layer, values): void

Defined in: src/refiner/main.ts:220

Add a filter

Parameters

layer

"tags" | "groups" | "tests"

The layer to add the filter to

values

string[]

The values to add to the filter

Returns

void


allows()

allows(testOrGroup): boolean

Defined in: src/refiner/main.ts:241

Check if refiner allows a specific test or group to run by looking at the applied filters

Parameters

testOrGroup

Test<any> | Group

The test or group to check

Returns

boolean

True if the test or group is allowed to run


isPinned()

isPinned(test): boolean

Defined in: src/refiner/main.ts:210

Find if a test is pinned

Parameters

test

Test<any>

The test to check

Returns

boolean

True if the test is pinned


matchAllTags()

matchAllTags(state): this

Defined in: src/refiner/main.ts:191

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

Parameters

state

boolean

Enable or disable matching of all tags

Returns

this

The refiner instance


pinTest()

pinTest(test): void

Defined in: src/refiner/main.ts:200

Pin a test to be executed.

Parameters

test

Test<any>

The test to pin

Returns

void