cypress-axe icon indicating copy to clipboard operation
cypress-axe copied to clipboard

Warnings with Webpack 5

Open Develliot opened this issue 4 years ago • 5 comments

WARNING in ./node_modules/cypress-axe/dist/index.js 16:47-54
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./cypress/support/index.js 3:0-21
 @ ./node_modules/@cypress/webpack-dev-server/dist/loader.js!./node_modules/@cypress/webpack-dev-server/dist/browser.js 2:30-69
 @ ./node_modules/@cypress/webpack-dev-server/dist/browser.js 3:4-41

WARNING in ./node_modules/cypress-axe/dist/index.js 16:77-84
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./cypress/support/index.js 3:0-21
 @ ./node_modules/@cypress/webpack-dev-server/dist/loader.js!./node_modules/@cypress/webpack-dev-server/dist/browser.js 2:30-69
 @ ./node_modules/@cypress/webpack-dev-server/dist/browser.js 3:4-41

Develliot avatar Sep 23 '21 08:09 Develliot

I don't think I found what fixed this it might have been a magical combination of webpack and webpack cli / dev server version numbers because I was using Cypress component testing.

Also I moved all my commands using cypress-axe from support/command to support/index and everything seems to be working now.

Develliot avatar Oct 05 '21 12:10 Develliot

Another tip is that if you update to the new webpack dev server, may be you are running tests with cypress component tests you probably want to set the webpack config with something like this:

  devServer: {
    host: "0.0.0.0",
    port: 8080,
    client: {
      overlay: {
        errors: true,
        warnings: false,
      },
    },

because these warns start to appear in an overlay which will cause your tests to fail.

Develliot avatar Nov 08 '21 15:11 Develliot

I get this same warning with Webpack 4 and Cypress Component Testing. I wasn't encouraged much by the related thread on the axe-core repo but I can confirm the webpack config setting to disable overlay warnings works! Thanks for that. Here are the docs I used, if anyone else needs them: https://webpack.js.org/configuration/dev-server/#overlay

marcysutton avatar Nov 16 '21 21:11 marcysutton

here is a PR that fixes this issue. https://github.com/component-driven/cypress-axe/pull/120

smmccabe avatar Feb 03 '22 18:02 smmccabe

Seems this issue could be closed.

srikanthkyatham avatar Jun 16 '22 12:06 srikanthkyatham