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

Cypress doesn't find tests when custom webpack config uses code-splitting #2745

Closed
oswaldofreitas opened this issue Oct 15, 2018 · 6 comments

Comments

@oswaldofreitas
Copy link

Version

3.0.5

Reproduction link

https://github.com/vuejs/vue-cli

Node and OS info

Node 10.11.0 / npm 6.4.1 / macOS Mojave 10.14

Steps to reproduce

  1. create a new project via vue create and add cypress as e2e test tool
  2. add a new vue.config.js file with the following content:
module.exports = {
  configureWebpack: {
    optimization: {
      runtimeChunk: {
        name: 'manifest',
      }
    }
  }
}

What is expected?

tests ran fine on npm run test:e2e

What is actually happening?

A "No tests found in your file" message is shown in Cypress and no tests are executed


I'm not sure if it's a vue cli or cypress issue, so I opened this issue too in cypress repo

@LinusBorg
Copy link
Member

Please see my comment in the cypress issue you linked.

We think the issue with with the cypress webpack preprocessor. A workaround should look like this:

module.exports = {
  configureWebpack: () => {
    return {
      optimization: {
        runtimeChunk: process.env.CYPRESS_ENV ? undefined : {
          name: 'manifest',
        }
      }
    }
  }
}

We'll see how the problem in the cypress repository develops and will determine how to deal with this in our own repo accordingly.

@LinusBorg LinusBorg changed the title Cypress doesn't find tests Cypress doesn't find tests when custom webpack config uses code-splitting Oct 16, 2018
@leeuwd
Copy link

leeuwd commented Oct 16, 2018

I'm having the same/comparable issue. Still working on it. See cypress-io/cypress#2608

@oswaldofreitas
Copy link
Author

sorry for dumb question, but how do I get process.env.CYPRESS_ENV different than undefined?

I just added console.log(process.env.CYPRESS_ENV) to my vue.config.js and ran npm run test:e2e and it logged undefined

@oswaldofreitas
Copy link
Author

hm, I think CYPRESS_ENV is true after vue.config.js is read, tried your workaround and worked! Thank you @LinusBorg

@LinusBorg
Copy link
Member

I opened an issue in the cypress-webpack-preprocessor reporsitory as I think the problem should be solved there.

cypress-io/cypress-webpack-preprocessor#31

@sodatea
Copy link
Member

sodatea commented Jan 18, 2019

Now that we've removed webpack preprocessor from default cypress config (#2904), there's no remaining actionable item in vue cli, so I'm closing this issue.

@sodatea sodatea closed this as completed Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants