Skip to main content

required-tags

Require tags/patterns of tags. The properties for levels (global, feature, rule, scenario and example), are arrays, that allows strings, regular expressions and subarrays. If a subarray is used, only one of the tags inside the subarray is needed to accomplish the rule.

Configuration

NameTypeDescriptionDefault
ignoreUntaggedbooleanWhether to ignore scenarios that have no tag.true
global(string | regexp | (string | regexp)[])[]The array of tag patterns that must match.
feature(string | regexp | (string | regexp)[])[]The array of tag patterns that must match.
rule(string | regexp | (string | regexp)[])[]The array of tag patterns that must match
scenario(string | regexp | (string | regexp)[])[]The array of tag patterns that must match.
example(string | regexp | (string | regexp)[])[]The array of tag patterns that must match.
extendRulebooleanWhen Scenario is not contained inside Rule, extends required rule tags to scenario.false
extendExamplebooleanWhen Scenario is not a Scenario Outline, extends required example tags to scenario.false

Examples

Define required tags for feature level with a Regular Expression

Enforce all features to have the tag @Feat(<ID>), where <ID> is a 5 digits number. E.g. @Feat(00123), @Feat(32109)

{
"required-tags": [
"error",
{
"feature": "/@Feat\\([0-9]{5}\\)/"
}
]
}

Define a list of required tags with one present

Enforce all scenarios to have the tag @ready, or @manual or @wip. A combination of them are allowed too.

{
"required-tags": [
"error",
{
"scenario": [
[
"@ready",
"@manual",
"@wip"
]
]
}
]
}

Mix required tag, and sublist of required tags

Enforce all scenarios to have the tag @ready, or @manual or @wip. A combination of them are allowed too.

{
"required-tags": [
"error",
{
"scenario": [
"/@ID\\.[0-9]{1,5}/",
[
[
"@ready",
"@manual",
"@wip"
]
]
]
}
]
}