Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.57 KB

no-replace-test-comments.md

File metadata and controls

50 lines (32 loc) · 1.57 KB

ember/no-replace-test-comments

Ember developers using blueprints to generate classes should write real tests.

Leaving the default test comment in place is a sign of a rushed class.

Note: this rule will not be added to the recommended configuration because it would cause the default ember-cli blueprint to contain lint violations.

Rule Details

This rule aims to nudge developers into writing more/better tests.

It aims to do this by complaining at them early about a default test file.

This rule only fires for test files (ending in '-test.js' or '-test.ts')

This will especially push TDD (test-driven development) on repos with githooks that enforce lint early.

Examples

Examples of incorrect code for this rule:

// Replace this with your real tests.
test('it exists', function (assert) {
  const service = this.owner.lookup('service:company');
  assert.ok(service);
});

Examples of correct code for this rule:

test('it has a purpose beyond mere existence', function (assert) {
  const service = this.owner.lookup('service:company');
  set(service, 'company', myCompanyMock);
  assert.equal(service.isOnboardingComplete, true, 'the computed property works as expected');
});

Migration

References