Akryum / vue-cli-plugin-apollo

🚀 @vue/cli plugin for Vue Apollo
https://vue-cli-plugin-apollo.netlify.com/
479 stars 110 forks source link

SyntaxError: Unexpected token ... when yarn run test:e2e with vue-cli #72

Open tea7day opened 5 years ago

tea7day commented 5 years ago

E2E tests throw an error originating in vue-cli-plugin-apollo/index.js:58

It would seem cypress does not understand spread syntax.

Current behavior:

Tests failed because of unknown syntax

screen shot 2018-10-24 at 4 05 48 pm

Desired behavior:

Tests work

Steps to reproduce:

  1. create vue project by vue-cli ($vue create myapp -> Manually select features -> add e2e testing(cypress))
  2. add vue-apollo plugin ($vue add apollo, default choice)
  3. run e2e testing ($yarn test:e2e)

Versions

@vue/cli: 3.0.5 @vue/cli-plugin-e2e-cypress: 3.0.5 vue-cli-plugin-apollo: 0.17.2

kode8 commented 5 years ago

Anyone found a fix for this?

kode8 commented 5 years ago

Temporary fix

` const webpack = require('@cypress/webpack-preprocessor'); const { VueLoaderPlugin } = require('vue-loader');

const webpackOptions = { module: { rules: [ { test: /.vue$/, loader: 'vue-loader' } ] }, plugins: [ // make sure to include the plugin for the magic new VueLoaderPlugin() ] };

const options = { // send in the options from your webpack.config.js, so it works the same // as your app's code webpackOptions, watchOptions: {} };

module.exports = (on, config) => { on( 'file:preprocessor', webpack(options) // webpack({ // webpackOptions: require('@vue/cli-service/webpack.config'), // watchOptions: {} // }) );

return Object.assign({}, config, { fixturesFolder: 'tests/e2e/fixtures', integrationFolder: 'tests/e2e/specs', screenshotsFolder: 'tests/e2e/screenshots', videosFolder: 'tests/e2e/videos', supportFile: 'tests/e2e/support/index.js' }); }; `

Akryum commented 4 years ago

I have cypress running in the E2E tests of vue-apollo. Do you have a minimal runnable reproduction?