Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Feature to fail invalid async testsΒ #91

@mfulton26

Description

@mfulton26

Mocha has an async-only option to "force all tests to take a callback (async) or return a promise". This is very handy as it protects developers from creating tests that always pass regardless of the expect statements. e.g.:

Always passes:

it('should have a link to Protractor's website', () => {
  expect(anchor.getAttribute('href')).toEqual('http://www.protractortest.org/#/');
});

Passes whenever the expect statement passes:

it('should have a link to Protractor's website', () => {
  return expect(anchor.getAttribute('href')).toEqual('http://www.protractortest.org/#/');
});

All it takes is that missing return keyword.

I propose adding a feature similar to Mocha's (perhaps even enabled by default) to force each it to receive a done argument or to return a promise.

Or, if possible, it would be great to simply have some kind of lint check that runs to confirm that there aren't any ignored promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions