Skip to content

Commit

Permalink
add background-setup-only rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Markham committed Sep 25, 2024
1 parent 86b7b68 commit ff2dd06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { dialects } from '@cucumber/gherkin'

import { switchOrSeveritySchema } from '../schemas'
import Schema from '../schema'
import Rule from '../rule'
import { RawSchema, AcceptedSchema } from '../types'
import Document from '../document'

export default class BackgroundOnlySetup implements Rule {
public readonly name: string = 'background-only-setup'
export default class BackgroundSetupOnly implements Rule {
public readonly name: string = 'background-setup-only'

public readonly acceptedSchema: AcceptedSchema = switchOrSeveritySchema

Expand Down
8 changes: 4 additions & 4 deletions tests/acceptance/features/background-setup-only.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ Feature: Background Setup Only
"""
When Gherklin is ran with the following configuration
| rules |
| {"background-only-setup": "error"} |
| {"background-setup-only": "error"} |
Then there is 1 file with errors
And the errors are
| location | severity | rule | message |
| {"line": 4, "column": 5} | error | background-only-setup | Background should only be used for set up. Found "Then". |
| {"line": 5, "column": 5} | error | background-only-setup | Background should only be used for set up. Found "And". |
| {"line": 4, "column": 5} | error | background-setup-only | Background should only be used for set up. Found "Then". |
| {"line": 5, "column": 5} | error | background-setup-only | Background should only be used for set up. Found "And". |

Scenario: Valid
Given the following feature file
Expand All @@ -30,5 +30,5 @@ Feature: Background Setup Only
"""
When Gherklin is ran with the following configuration
| rules |
| {"background-only-setup": "error"} |
| {"background-setup-only": "error"} |
Then there are 0 files with errors

0 comments on commit ff2dd06

Please sign in to comment.