-
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
Nested tests? #62
Comments
With the nature of AVA as I understand, I can't imagine this taking much work. |
Shouldn't be very hard. Not sure we want this, though. I've honestly never needed it. You could achieve the same thing with multiple files (which would also be beneficial for parallelism). Do you have a real scenario you could link to where this was useful? |
👍 for multiple files anyway. I think it's intended to be synonymous with Mocha's |
not a big deal either way but files usually correspond 1:1 with what file they're testing. it's often useful when testing say, a user model, to have different bootstrapping functions. alternatively, this could also be achieved with something along the lines of: test('a model', function (t) {
t.before(function() { ... })
})
test('a model', function (t) {
t.after(function() { ... })
}) which would work without nesting. |
hey. 🐱 it's worth mentioning that test('a test', function(t) {
t.test('a sub-test', function (t) {
// do test
})
}) personally, i think this would be awesome for test('a test', function(t) {
t.test.before(function (t) {
// setup
})
t.test.after(function (t) {
// teardown
})
t.test('a sub-test', function (t) {
// do test
})
}) |
+1, would you accept a PR for this? |
I still feel it's an anti-pattern and nobody has convinced me otherwise (hint hint). Having tests in separate files instead of nesting has the benefit of cleaner test files and parallelism. @vdemedes @kevva Thoughts? |
Honestly, I don't think it's a good idea. It does not look good, it will cause bugs and it does not make much sense to use |
closing since there doesn't seem to be much interest by the authors. |
The only good case I see use to have nested is to include (using |
Locking in favor of duplicate #222. Please move all discussion there. |
One thing that's nice about nested tests is being able to support different before, after, beforeEach, and afterEach functions.
Would probably be a pretty large refactor, but I could see API looking like this:
The text was updated successfully, but these errors were encountered: