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
Right now beforeEach has limited utility in concurrent tests. The following won't work because both tests manipulate a shared variable and run concurrently:
varobj;test.beforeEach(t=>{obj=// ... some verbose setup code. t.end();});test('test1',t=>{// tests with side-affects on `obj` // sometime latert.end();});test('test2',t=>{// tests with side-affects on `obj` // sometime latert.end();});
To address this, I think it would be good to provide a this reference that is shared between beforeEach and the individual test:
Right now
beforeEach
has limited utility in concurrent tests. The following won't work because both tests manipulate a shared variable and run concurrently:To address this, I think it would be good to provide a
this
reference that is shared betweenbeforeEach
and the individual test:The above is maybe not the best example and might fail since I doubt we are guaranteeing test instantiation order in a concurrent testing framework.
Another alternative might be to pass the context as an optional second arg:
This has the advantage of avoiding
self
reference verbosity.The text was updated successfully, but these errors were encountered: