diff --git a/lighthouse-core/gather/gatherers/accessibility.js b/lighthouse-core/gather/gatherers/accessibility.js index 7b18e9d7faf8..521358917c93 100644 --- a/lighthouse-core/gather/gatherers/accessibility.js +++ b/lighthouse-core/gather/gatherers/accessibility.js @@ -16,18 +16,18 @@ */ 'use strict'; -/* global document */ +/* global window, document */ const Gatherer = require('./gatherer'); const fs = require('fs'); -const axe = fs.readFileSync(require.resolve('axe-core/axe.min.js'), 'utf8'); +const axeLibSource = fs.readFileSync(require.resolve('axe-core/axe.min.js'), 'utf8'); // This is run in the page, not Lighthouse itself. // axe.run returns a promise which fulfills with a results object // containing any violations. /* istanbul ignore next */ function runA11yChecks() { - return axe.run(document, { + return window.axe.run(document, { runOnly: { type: 'tag', values: [ @@ -54,7 +54,7 @@ class Accessibility extends Gatherer { afterPass(options) { const driver = options.driver; const expression = `(function () { - ${axe}; + ${axeLibSource}; return (${runA11yChecks.toString()}()); })()`;