Skip to content

Commit

Permalink
return error for getContext in addon-test-support/setup-middleware-re…
Browse files Browse the repository at this point in the history
…porter.ts

Co-authored-by: Chris Krycho <hello@chriskrycho.com>
  • Loading branch information
robostheimer and chriskrycho authored May 22, 2023
1 parent 6f8e31b commit 44ebf3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addon-test-support/setup-middleware-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ export async function middlewareReporter(axeResults: AxeResults) {

if (!currentTestResult) {
let { module, testName } = QUnit.config.current;
const context = getContext() ?? {};
const context = getContext();
if (!context) {
throw new Error(
'You tried to run ember-a11y-testing without calling one of the `setupTest` helpers from `@ember/test-helpers`. Please make sure yoru test setup calls `setupTest()`, `setupRenderingTest()`, or `setupApplicationTest()`!'
);
}
let testMetaData = getTestMetadata(context);

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

0 comments on commit 44ebf3b

Please sign in to comment.