Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-pattern-restrictions rule #184

Merged
merged 2 commits into from
May 4, 2019
Merged

no-pattern-restrictions rule #184

merged 2 commits into from
May 4, 2019

Conversation

vsiakka
Copy link
Collaborator

@vsiakka vsiakka commented May 4, 2019

  • Make Scenario, ScenarioOutline and Background patterns apply to
    corresponding names and descriptions (consistency with Feature)
  • Make all patterns case insensitive (consistency with Feature and Global patterns)
  • Add violated pattern to error message for more clarity (multiple
    patterns can produce multiple errors)
  • Fix error messages when a violation is detected in a multi-line description

@jhedstrom fyi, i realized these bugs after merging the PR and thinking more about the rule. My turn around time on PRs has been poor so i decided to fix them myself since I had some time today.

- Make Scenario, ScenarioOutline and Background patterns apply to
corresponding names and descriptions
- Make all patterns case insensitive
- Make sure rule doesn't break on an empty scenario
- Add violated pattern to error message for more clarity (multiple
patterns can produce multiple errors)
it('doesn\'t raise errors when there are no violations', function() {
runTest('no-restricted-patterns/NoViolations.feature', {
'Global': [
'^.*disallowed.*$'
]}, []);
});

it('detects errors for features, scenarios, backgrounds, and scenario outlines', function() {
runTest('no-restricted-patterns/Violations.feature', {
it('detects errors in Feature names and descriptions that match the Feature or Global config', function() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split up the tests, because the number of errors was becoming pretty big and the file was becoming unreadable.

@coveralls
Copy link
Collaborator

coveralls commented May 4, 2019

Pull Request Test Coverage Report for Build 430

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 93.952%

Files with Coverage Reduction New Missed Lines %
dist/rules/no-restricted-patterns.js 1 94.0%
Totals Coverage Status
Change from base Build 423: 0.2%
Covered Lines: 595
Relevant Lines: 613

💛 - Coveralls

function checkNameAndDescription(node, restrictedPatterns, errors) {
restrictedPatterns[node.type]
.forEach(function(pattern) {
check(node, 'name', pattern, errors);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenarios and ScenarioOutlines also have a name
Scenarios and ScenarioOutlines and Background also have a description

@vsiakka vsiakka merged commit 53dbda7 into master May 4, 2019
@vsiakka vsiakka deleted the noRestrictedPatterns branch May 4, 2019 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants