-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Impossible to use t.try
in before hook
#2511
Comments
Good find @tymfear! Looking at the code, we don't enforce unique titles for hooks. Which means that we shouldn't allow them to use snapshots either, so that's a bit of an oversight. Enforcing unique titles for before and after hooks isn't as straight-forward as it sounds. I'm tempted to explicitly fail these assertions in all hooks going forward (though this would be a breaking change when it comes to snapshots). What would you think of that? What setup / teardown problems are you running into that require |
@novemberborn I was just using it to check if my preconditions are fulfilled and I can go on with tests. It was part of the retry mechanism. I was using the Probably, another parameter could be added to the |
You can already provide the title. Really what it comes down to is that snapshots require unique titles, and we're not enforcing title uniqueness for hooks. I'm just not sure that we should, which means we should be explicitly failing |
See #2523. |
Please provide details about:
What you're trying to do
Use
t.try
in thetest.before
hookWhat happened
The following error is thrown:
TypeError { message: 'test.registerUniqueTitle is not a function', }
No error are thrown
Please share relevant sample code. Or better yet, provide a link to a minimal reproducible example.
We'll also need your AVA configuration (in
package.json
orava.config.*
configuration files) and how you're invoking AVA. Share the installed AVA version (get it by runningnpx ava --version
).AVA version:
3.8.2
Config:
AVA is invoked with
npx ava path/to/file
command. Also reproducible with IDEA Node configurationThe text was updated successfully, but these errors were encountered: