Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.31 KB

no-test-return-value.md

File metadata and controls

48 lines (34 loc) · 1.31 KB

Disallow test functions with a return value (square/no-test-return-value)

💼 This rule is enabled in the 🔥 ember config.

💡 This rule is manually fixable by editor suggestions.

For asynchronous tests, use async/await instead of returning a promise.

Some tests may have unnecessary return statements leftover from running decaffeinate.

Examples

Examples of incorrect code for this rule:

test('it does something', function (assert) {
  const thenable = new Promise();
  return thenable;
});
test('it does something', function (assert) {
  return assert.ok(something); // unnecessary return
});

Examples of correct code for this rule:

test('it does something', async function (assert) {
  const thenable = new Promise();
  await thenable;
});
test('it does something', function (assert) {
  assert.ok(something);
});

Configuration

  • object -- containing the following properties:
    • String[] -- testHooks -- optional array of test hook names to use (see rule implementation for the default list)