You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Do child beforeEach() override parent beforeEach() or are they all executed in order? #134
Not sure which behavior is best, but whatever hTest implements it should be documented!
On one hand, executing both is probably what most use cases want. On the other hand, then there is no way around it when it's not what you want.
Edit: They override and require this.parent.parent.beforeEach() to invoke the parent with this.parent.beforeEach() causing a stack overflow. Yikes. this.parent should just work. I'm gonna change this to Bug.
Edit 2: Even more mysterious that for beforeAllthis.parent works just fine!!
Edit 3: And it apparently requires .call(this) because data doesn't seem to inherit properly?
On one hand, executing both is probably what most use cases want. On the other hand, then there is no way around it when it's not what you want.
I honestly believe that what we have now is much better than other frameworks suggest. We can define the common behavior on the most appropriate ancestor and tweak it the way you like. Yes, we redefine it by default by adding the same hook on a descendant. And we need to be explicit (and I think that's a good thing; no magic) if we want the ancestor's hook to be executed first (via this.patent.<hook>). But we can do much more than that. We can control where the ancestor's hook should be executed: before our custom actions, after them, or even somewhere in the middle. And that makes complex things possible and simple things easy. So, it's fully aligned with the philosophy we follow.
whatever hTest implements it should be documented!
Edit: They override and require this.parent.parent.beforeEach() to invoke the parent with this.parent.beforeEach() causing a stack overflow. Yikes. this.parent should just work. I'm gonna change this to Bug.
This should go away when we address the more general issue: #147.
Edit 2: Even more mysterious that for beforeAllthis.parent works just fine!!
I think it's because beforeAll is not inherited. So, we can reference the parent's hook just fine.
Edit 3: And it apparently requires .call(this) because data doesn't seem to inherit properly?
Activity
Fix this.parent resolution for inherited functions
Fix this.parent resolution for inherited functions
Fix this.parent resolution for inherited functions
Fix this.parent resolution for inherited functions
Fix this.parent resolution for inherited functions
DmitrySharabin commentedon May 24, 2026
I honestly believe that what we have now is much better than other frameworks suggest. We can define the common behavior on the most appropriate ancestor and tweak it the way you like. Yes, we redefine it by default by adding the same hook on a descendant. And we need to be explicit (and I think that's a good thing; no magic) if we want the ancestor's hook to be executed first (via
this.patent.<hook>). But we can do much more than that. We can control where the ancestor's hook should be executed: before our custom actions, after them, or even somewhere in the middle. And that makes complex things possible and simple things easy. So, it's fully aligned with the philosophy we follow.Agreed. I'll do it soon. UPDATE: Done in b6999e8.
This should go away when we address the more general issue: #147.
I think it's because
beforeAllis not inherited. So, we can reference the parent's hook just fine.It should already be fixed in 0eada46.
Document lifecycle hook inheritance and override semantics, partially…