test: fix debug mode failing tests - #4769
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Running `npm run test:unit` results in loads of failures. After racking my brain about why, I remembered I had a similar problem in my [fixing `npm run test:debug` pr](#4769) where resetting the memoize functions results in them not being able to clear the cache between tests. Turns out that was the issue here. Note: this isn't a problem in our pr runs or nightly tests because we either call `npm run: test:unit:<name>` directly or run `npm test` which runs all the tests in turn. This only happens when running `npm run test:unit` since the browser doesn't close between test types.
Running `npm run test:unit` results in loads of failures. After racking my brain about why, I remembered I had a similar problem in my [fixing `npm run test:debug` pr](#4769) where resetting the memoize functions results in them not being able to clear the cache between tests. Turns out that was the issue here. Note: this isn't a problem in our pr runs or nightly tests because we either call `npm run: test:unit:<name>` directly or run `npm test` which runs all the tests in turn. This only happens when running `npm run test:unit` since the browser doesn't close between test types.
Running `npm run test:unit` results in loads of failures. After racking my brain about why, I remembered I had a similar problem in my [fixing `npm run test:debug` pr](#4769) where resetting the memoize functions results in them not being able to clear the cache between tests. Turns out that was the issue here. Note: this isn't a problem in our pr runs or nightly tests because we either call `npm run: test:unit:<name>` directly or run `npm test` which runs all the tests in turn. This only happens when running `npm run test:unit` since the browser doesn't close between test types.
|
This is no longer a problem since we moved off karma and to the new test framework. |
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:
#mochadiv 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. otherh1s). 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#mochadiv element would break our grid stack, rect, and target size tests as it would add elements to the stack our tests weren't expecting#mochadiv 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 testcomputedStylecause the code to freeze (not sure why yet, still investigating)axe._memoizedFnslength to 0 meant ourteardowncode 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:
#mochadiv 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)