version added: 1.0.0

Decide selectively which tests should run based on a substring or pattern match.


type string or undefined
default undefined

This option is available as CLI option, as control in the HTML Reporter, and supported as URL query parameter.

Only run tests of which the module name or test name have a case-insensitive substring match for the provided string. You can inverse the filter, to run all tests that don’t contain the string, by prefixing a bang character (!) to the string.

You can also match via a regular expression by setting the filter to a regular expression literal in string form, encloses by slashes, such as /(this|that)/i.

While substring filters are always case-insensitive, a regular expression is only insensitive when passing the /i flag.


Example: Substring filter

The below matches QUnit.module( "FooBar" ) and QUnit.test( "createFooBar" ).

QUnit.config.filter = 'foo';

As inverted filter, the below would skip QUnit.module( "FooBar" ) and QUnit.test( "createFooBar" ), but match QUnit.module( "Bar" ) and QUnit.test( "createBar" ).

QUnit.config.filter = '!foo';

Example: Regular expression filter

The below would match QUnit.test( "foo" ), but not QUnit.test( "Foo" ).

QUnit.config.filter = '/foo/';

The below would both match QUnit.test( "foo" ) and QUnit.test( "Foo" ).

QUnit.config.filter = '/foo/i';