Jest/karma example wording eslint rule

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

For RSpec, we now use the RSpec/ExampleWording cop to lint example titles. https://gitlab.com/gitlab-org/gitlab-ce/issues/59783

Enable RSpec/ExampleWording cop against using should in RSpec example titles

The RSpec linter can also perform other cleanup like unneeded it. e.g. it 'it is a cake' {}


We have the same should cases in jest and karma.

I haven't looked into eslint options yet, just wanted to get an issue up.

// BAD
it('should return a cake', () => expect(cakeFactory(opts)).toBeInstanceOf(Cake));
  
end

// GOOD
it('returns a cake', () => expect(cakeFactory(opts)).toBeInstanceOf(Cake));

This could be the foundation/start of more linting for our specs. As a note, we also have issues with titles that don't provide much insight. e.g. describe('AppComponent', ()=>{})


  • http://www.betterspecs.org/#should
  • https://rubocop-rspec.readthedocs.io/en/latest/cops_rspec/#rspecexamplewording
Edited Sep 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading