Skip to content

Commit

Permalink
Ensures context for current URL & route middleware reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
drewlee committed Aug 24, 2023
1 parent dba9705 commit 9ee3f25
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions addon-test-support/setup-middleware-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ export async function middlewareReporter(axeResults: AxeResults) {
return;
}

const context = getContext();

if (!currentTestResult) {
let { module, testName } = QUnit.config.current;
let testMetaData = getTestMetadata(getContext());
let testMetaData = getTestMetadata(context);

let stack = (!DEBUG && new Error().stack) || '';

Expand All @@ -96,8 +98,10 @@ export async function middlewareReporter(axeResults: AxeResults) {
currentRouteNames = new Set();
}

currentUrls!.add(currentURL());
currentRouteNames!.add(currentRouteName());
if (context) {
currentUrls!.add(currentURL());
currentRouteNames!.add(_getCurrentRouteName());
}

axeResults.violations.forEach((violation) => {
let rule = currentViolationsMap!.get(violation.id);
Expand Down

0 comments on commit 9ee3f25

Please sign in to comment.