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

fix: using addContext inside a before or after hook should work as expected #286

Merged
merged 1 commit into from
Jun 15, 2019

Conversation

adamgruber
Copy link
Owner

Prior to mocha 6.0.0, calling addContext in a before or after hook would correctly add the context to the hook object. However due to a change in mocha, the assumptions made inside addContext no longer held true. This is causing the context to be added to the tests instead of the hook. This PR fixes the behavior.

Alternate approach to #285. Uses a simple regex to determine if the hook is an each hook or not.

…context to the hook

This worked as expected in versions of mocha prior to `6.0.0` but due to a change the assumptions made inside `addContext` no longer held true.
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

Successfully merging this pull request may close these issues.

1 participant