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

Add typescript/webpack configuration to readme #10

Closed
annedroiid opened this issue Jun 3, 2019 · 1 comment · Fixed by #18
Closed

Add typescript/webpack configuration to readme #10

annedroiid opened this issue Jun 3, 2019 · 1 comment · Fixed by #18

Comments

@annedroiid
Copy link

I am creating a new issue for #7 as the original owner closed it despite the issue not being resolved. If you are having issues getting cypress-axe to work with Typescript/Webpack, please look at that issue for solutions.

@NicholasBoll
Copy link
Contributor

NicholasBoll commented Oct 23, 2019

I ran into this issue. After digging into it, I have no idea why eval is used in the original script. This is my workaround:

support/commands.ts

import * as axe from 'axe-core';

declare global {
  interface Window {
    axe: typeof axe
  }
}

Cypress.Commands.add('injectAxe', () => {
  cy.window({ log: false }).then(window => {
    window.axe = axe;
  })
})

This will simply assign the value returned by the import rather than running eval on the source (which is already done by the import...)

I'll open a PR to this repo since this should work for both browserify and webpack.

NicholasBoll added a commit to NicholasBoll/cypress-axe that referenced this issue Oct 23, 2019
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 a pull request may close this issue.

2 participants