test(wtr): consolidate __lwcReset
functions into a single file @W-19098255
#5532
+387
−324
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
There are a few scenarios where the runtime has an internal global state, such as tracking warnings that only get logged once. Tests, however, often need to run in isolation, so the internal global state must be reset. When running integration tests, the framework exposes a family of helpers, all prefixed with
__lwcReset
. When encountered within the integration tests, it is not obvious where these functions come from, or why they exist. In order to remove some "magic" from the tests, this PR consolidates the reset functions into a single test helper file, which explains each function and points to its source.Additionally, to reduce test framework "magic" (and negligibly improve performance), this PR eliminates the global
afterEach
in favor of including an explicitafterEach
only where required.Lastly, this PR changes the
NODE_ENV
check fromtest-karma-lwc
totest-lwc-integration
because we don't use Karma any more.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item