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

console print error when I use cypress work with webpack. #1122

Closed
wangzhenxi opened this issue Apr 13, 2018 · 3 comments
Closed

console print error when I use cypress work with webpack. #1122

wangzhenxi opened this issue Apr 13, 2018 · 3 comments

Comments

@wangzhenxi
Copy link

wangzhenxi commented Apr 13, 2018

Version

3.0.0-beta.6

Reproduction link

https://codepen.io/imjoshwong/pen/dmEzmB

Steps to reproduce

when I use vue-cli to create a project, I found the created folder haven't "webpack.config.js" file.I use my webpack config to this project and the project can run successfully. Then, I want to test my project, the console printed some error, I want to know why, so I found the document https://github.com/cypress-io/cypress-webpack-preprocessor, and install a plugin "@cypress/webpack-preprocessor", and add some config in plugins config, but the error is still exist.

// tests/plugins/index.js
const webpack = require('@cypress/webpack-preprocessor')

module.exports = (on, config) => {
  on('file:preprocessor', webpack({
    webpackOptions: require('../../webpack.config.js')
  }))
  return Object.assign({}, config, {
    fixturesFolder: 'tests/fixtures',
    integrationFolder: 'tests/specs',
    screenshotsFolder: 'tests/screenshots',
    videosFolder: 'tests/videos',
    supportFile: 'tests/support/index.js'
  })
}

What is expected?

I want to the progress run successfully as the first time.

What is actually happening?

The error is that the process cannot make out the webpack alias, and recommand me to install the alias, that is error absolutely.

@dhensche
Copy link
Contributor

I could be wrong, but I believe the intent with v3.x is to not have a webpack.config.js file per se, and instead use one of documented methods to make webpack modifications.

@LinusBorg
Copy link
Member

@dhesche is correct. If you use vue-cli 3, you don't define any webpack.config.js your own.

@laurentpayot
Copy link

laurentpayot commented Apr 14, 2018

@Joshwoooooooooooooooooooooooooooooooong you have to define your own config as your example is referencing to a non-existing (in vue-cli 3) webpack.config.js file.
This plugin config is used internally by Cypress, to set preprocessors, aliases for imports, loaders etc. To import project file for unit testing with Cypress it should be the same as the Vue config modified with chainWebpack or configureWebpack via vue.config.js.

You can see a full example of the Cypress plugin file here: quasarframework/quasar-cli#83 (comment)

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

No branches or pull requests

4 participants