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

Feature to fail invalid async tests #91

Open
mfulton26 opened this issue Aug 17, 2017 · 0 comments
Open

Feature to fail invalid async tests #91

mfulton26 opened this issue Aug 17, 2017 · 0 comments

Comments

@mfulton26
Copy link

mfulton26 commented Aug 17, 2017

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.

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

No branches or pull requests

1 participant