test: fix debug mode failing tests #4769
Draft
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.
Trying to debug Firefox nightly test failures and I kept running into a problem with debug mode freezing or having tests fail. I'm still working on fixing all the issues, but here's what I've found so far:
#mocha
div element would break a lot of our tests that looked at element selectors (especiallyempty-heading
) since it would add non-unique elements to our tests (e.g. otherh1
s). This caused one of the tests to freeze and even crash the page as it would try to compare the result object and tried to output the entire contents of the DOM which would exceed the max string length#mocha
div element would break our grid stack, rect, and target size tests as it would add elements to the stack our tests weren't expecting#mocha
div would cause some our tests that used very large heights to move things off the page to fail when the entire test suite was run (but not individually) since the result list would end up being larger than the large height used in the testcomputedStyle
cause the code to freeze (not sure why yet, still investigating)axe._memoizedFns
length to 0 meant ourteardown
code didn't reset memoized results, causing test failures across test directories (utils -> commons). Our normal test setup runs all directories in isolationThere are some other random test failures in run and run-rules that I'm also still investigating.
My fixes include:
#mocha
div to a closed shadow DOM in order to remove it from the root DOM and hiding it from our selector generation (this still allows us to use the HTML ui and get all the nice output in the browser)