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
Any time the extension injects a new scope via constructor or function argument, it puts that scope into a MutableMap where the key its the ExtensionContext. This map is used in beforeEach to call setMain(...) and in afterEach to call resetMain() and cleanUpTestCoroutines().
Here's a simplified timeline of a JUnit5 test execution with parameter resolution:
Initialize extension (no context here for the internal scope property).
Create constructor dependencies and add to map.
Create class.
beforeEach()
Create function dependencies and add to map.
Execute test function with parameters.
afterEach()
Dispatchers.setMain(...) works with constructor parameters because they've been added to the map before beforeEach() is invoked. It doesn't work with the internal scope property because it's never added to the map. It also doesn't work for injected function parameters because they're constructed and added to the map afterbeforeEach() is invoked.
The text was updated successfully, but these errors were encountered:
Any time the extension injects a new scope via constructor or function argument, it puts that scope into a
MutableMap
where the key its theExtensionContext
. This map is used inbeforeEach
to callsetMain(...)
and inafterEach
to callresetMain()
andcleanUpTestCoroutines()
.This is the existing
beforeEach
:Here's a simplified timeline of a JUnit5 test execution with parameter resolution:
scope
property).beforeEach()
afterEach()
Dispatchers.setMain(...)
works with constructor parameters because they've been added to the map beforebeforeEach()
is invoked. It doesn't work with the internalscope
property because it's never added to the map. It also doesn't work for injected function parameters because they're constructed and added to the map afterbeforeEach()
is invoked.The text was updated successfully, but these errors were encountered: