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

test.cb.beforeEach and test.cb.afterEach throw error even though t.end() is defined #180

Open
niftylettuce opened this issue Oct 1, 2017 · 6 comments

Comments

@niftylettuce
Copy link

Even though I explicitly call t.end() in my beforeEach and afterEach functions, this error is still thrown:

Callback test was not ended. Make sure to explicitly end the test with `t.end()`. (ava/test-ended)
@niftylettuce niftylettuce changed the title test.cb.beforeEach and test.cb.afterEach throw error " test.cb.beforeEach and test.cb.afterEach throw error even though t.end() is defined Oct 1, 2017
@novemberborn
Copy link
Member

Could you share an example?

@niftylettuce
Copy link
Author

test.cb.beforeEach(t => {
  setTimeout(() => t.end(), 3000);
});

@novemberborn
Copy link
Member

@niftylettuce this works for me:

import test from 'ava'

test.cb.beforeEach(t => {
  setTimeout(() => t.end(), 3000);
});

test(t => t.pass())

If you're using test.cb() with a test, as well as in the before and after hooks, you still have to call t.end() inside the test itself.

@niftylettuce
Copy link
Author

niftylettuce commented Oct 1, 2017 via email

@novemberborn
Copy link
Member

@niftylettuce could you provide a full example of where this is failing for you?

@novemberborn
Copy link
Member

@niftylettuce were you referring to the example you posted at avajs/ava#1687 (comment)?

This seems to be similar to #119. I think test-ended should not error if a function reference is passed. Perhaps it could warn, but honestly that doesn't seem useful either.

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

2 participants