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

after hook not firing reliably #32

Closed
searls opened this issue Feb 4, 2015 · 16 comments
Closed

after hook not firing reliably #32

searls opened this issue Feb 4, 2015 · 16 comments

Comments

@searls
Copy link

searls commented Feb 4, 2015

In order for our tests to behave consistently, the after hooks for each suite need to execute consistently (so we can dump our database). What I'm finding is that when I run my suite with npm test, the after hooks (like this one) are not firing.

However if I grab an individual test like this one and set it to describe.only, then the after hook will fire just fine.

Any insight into this?

@searls
Copy link
Author

searls commented Feb 4, 2015

Ah, so it would seem that this is a mocha issue, reopened as recently as 20 hours ago. Wow.

mochajs/mocha#534

@dasilvacontin
Copy link

@searls, is it possible that the (async) before hook is failing? Because yesterday I found out that it bugs the run.

@searls
Copy link
Author

searls commented Feb 4, 2015

There is no evidence that one is failing. It seems happy right up to the point it calls done()

@dasilvacontin
Copy link

When it calls done inside the after? What happens then?

@searls
Copy link
Author

searls commented Feb 4, 2015

The after is never invoked if I run the whole suite. (I was referring to the before hook to answer your question)

@dasilvacontin
Copy link

Hmm, not sure if it's related to the bug I found.

@searls
Copy link
Author

searls commented Feb 4, 2015

(subtext: because the suite is erroring. when i run just a passing or failing subset of the suite, the after is invoked)

@dasilvacontin
Copy link

The suite is erroring? Where?

@searls
Copy link
Author

searls commented Feb 4, 2015

Okay I think we need to back up. I'm currently implementing this repo, which in turn is using this repo's test suite as a guide to figuring out how I need to implement it.

Because my adapter is half-implemented, most of the tests are going to be failing most of the time. I suspect that whenever a failure occurs due to an error being thrown, the suite's after hook does not fire. That is to say, after doesn't fire at all unless I intentionally run just one test or suite that I know to be passing (or failing logically and not throwing an error)

@dasilvacontin
Copy link

I see. What I've confirmed so far (and I'm currently fixing and adding new tests so that it doesn't happen again) is that an async failure in either a before hook or a test causes the after hook not to fire. We probably stopped setting up the uncaught exception handler at some point. Looking into it. :shipit:

@searls
Copy link
Author

searls commented Feb 4, 2015

That sounds about right. Apologies for the vague and probably overly-terse descriptions on my end (when we hopped repos I wasn't sure if you were representing Mocha or Sails)

@dasilvacontin
Copy link

No worries! Glad to help!

@CWyrtzen
Copy link

Howdy folks, is this resolved now?

@dasilvacontin
Copy link

I've been very busy lately, so I personally haven't been able to further investigate/make progress.

@dmarcelino
Copy link
Member

@searls, can you please try using the latest version of waterline-adapter-tests in master branch and filter out the broken tests using the example in #35? Let us know if that fixes this issue. Thanks

@dmarcelino
Copy link
Member

Closing this as abandoned, please reopen if you are still experiencing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants