Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsdom): allow axe.setup() without a global window #4116

Merged
merged 2 commits into from Aug 2, 2023
Merged

Conversation

WilcoFiers
Copy link
Contributor

axe.setup() should set up temporary globals when globalThis.window and/or globalThis.document aren't set up. This PR fixes that.

Closes #3962

@WilcoFiers WilcoFiers requested a review from a team as a code owner August 1, 2023 17:04
@@ -36,10 +36,10 @@ export default function run(...args) {
axe.utils.performanceTimer.start();
}

function handleRunRules(rawResults, cleanup) {
function handleRunRules(rawResults, teardown) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is actually just the teardown method, it's confusing to have it named something else here.

@@ -66,7 +66,6 @@ export default function run(...args) {
axe.utils.performanceTimer.end();
}
axe._running = false;
resetGlobals();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already called in teardown, which is invoked earlier. Calling resetGlobals here does nothing, and wouldn't actually have worked because axe's cache has been cleaned up by this point. Same is true for the other resetGlobals() call in this file.

@WilcoFiers WilcoFiers merged commit 33b0314 into develop Aug 2, 2023
17 checks passed
@WilcoFiers WilcoFiers deleted the dom-setup branch August 2, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

axe.setup should set globals
2 participants