Closed 1881713 closed 4 years ago
when running cypress 5.2.0 with cypress-axe i get: 'exports is not defined' error for axeFunction
is this related?
This issue seemed to be caused by this line https://github.com/component-driven/cypress-axe/blob/master/src/index.js#L5
Unsure why cypress 5 is unhappy with axe.source
. If I replace axe.source
with cy.readFile('node_modules/axe-core/axe.min.js')
it will solve the issue.
@aldosuwandi That works, thanks! I believe #72 should fix the problem with Cypress 5.
:tada: This issue has been resolved in version 0.10.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I am still getting this issue even using the latest version of cypress and cypress-axe, anyone found a solution?
FYI for those using typescript the following script in the cypress/support/commands.ts
file fixed it for me:
Cypress.Commands.add('injectAxe', () => {
cy.readFile('./node_modules/axe-core/axe.js').then(function (source) {
return cy.window({ log: false }).then(function (window) {
window.eval(source);
});
});
});
With Cypress 5.0 released, could this be added now to peerDependencies? I don't know if other changes would be needed.
"peerDependencies": { "cypress": "^3.1.1 || ^4.0.2" },