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 ignores specs #2564

Closed
warren-sadler opened this issue Oct 5, 2018 · 12 comments
Closed

Cypress ignores specs #2564

warren-sadler opened this issue Oct 5, 2018 · 12 comments
Assignees

Comments

@warren-sadler
Copy link

Current behavior:

Cypress seems to recognize the spec files...

finds spec files

However, it can't seem to find the test cases within.

however, can't reconcile tests

But there are totally tests.

even weirder, has test

Here is the corresponding stack

GET /__cypress/tests?p=tests/e2e/support/index.js-881 - - ms - -
GET /__cypress/tests?p=tests/e2e/specs/test.js-308 - - ms - -
GET /__cypress/iframes/integration/test.js 200 2.001 ms - 709
GET /__cypress/tests?p=tests/e2e/support/index.js-374 - - ms - -
GET /__cypress/tests?p=tests/e2e/specs/test.js-189 - - ms - -
GET /__cypress/iframes/integration/test.js 200 1.094 ms - 709
GET /__cypress/tests?p=tests/e2e/support/index.js-110 200 34.451 ms - -
GET /__cypress/tests?p=tests/e2e/specs/test.js-975 200 33.804 ms - -
GET /service-worker.js 200 4.864 ms - -
HEAD / 500 67.941 ms - -
HEAD / 500 48.766 ms - -
HEAD / 500 48.730 ms - -

Desired behavior:

I would hope the test would run, cypress would run my test-cases.

Steps to reproduce:

  1. Clone: https://github.com/warren-sadler/example-cypress-error
  2. npm install
    3.npm run test:e2e

Versions

Cypress 3.1.0, MacOS 10.13.6, Chrome 69

@warren-sadler warren-sadler changed the title Cypress says _No tests found in your file_ but there are test Cypress says "No tests found in your file" but there are test Oct 5, 2018
@warren-sadler warren-sadler changed the title Cypress says "No tests found in your file" but there are test Cypress ignores specs Oct 5, 2018
@chrisbreiding
Copy link
Contributor

If you open the browser DevTools, are there any errors in the console?

@warren-sadler
Copy link
Author

warren-sadler commented Oct 5, 2018

Before

// https://docs.cypress.io/guides/guides/plugins-guide.html
const webpack = require('@cypress/webpack-preprocessor')

module.exports = (on, config) => {
  on('file:preprocessor', 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'
  })
}

Removing this line: webpackOptions: require('@vue/cli-service/webpack.config') from the exports seems to address the issue.

After

// https://docs.cypress.io/guides/guides/plugins-guide.html
const webpack = require('@cypress/webpack-preprocessor')

module.exports = (on, config) => {
  on('file:preprocessor', webpack({
    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'
  })
}

So this appears to be more a misconfiguration of @vue/cli

@warren-sadler
Copy link
Author

@chrisbreiding Console logs look clean.

@oswaldofreitas
Copy link

oswaldofreitas commented Oct 8, 2018

same here, but I can't remove the webpack config line you mentioned because I'll have other errors like missing aliases

@chrisbreiding chrisbreiding self-assigned this Oct 9, 2018
@warren-sadler
Copy link
Author

@oswaldofreitas Are you referring to the import HelloWorld from "@/components/HelloWorld.vue" aliasing?

Yea, that's the only downer about the workaround, you lose all the vue-cli webpack goodness. Have you had any luck in troubleshooting this?

@oswaldofreitas
Copy link

in a new project created by vue create <proj> it seems to be fixed now with v3.0.5, but I didn't get to fix it yet in my project, it's something with url different from default localhost I guess. We're using php for backend and I'm trying to figure out what to change (--url option or baseUrl in cypress config, or .visit() url)

@peabnuts123
Copy link

I am also encountering this. Removing the file:preprocessor makes your code completely useless / impossible to test so that's not really an option. I am not really seeing many levers to pull to try and fix the problem, either. Seems to read the files fine but doesn't seem to be reading the contents of them, so even if I put throw new Error() at the top of the file it doesn't register / throw anything.

@oswaldofreitas
Copy link

oswaldofreitas commented Oct 15, 2018

Ok, I can reproduce it now :)

If I add a optimization section to my webpack config like this one:

optimization: {
  splitChunks: {
    cacheGroups: {
      vendor: {
        name: 'vendor',
        chunks: 'initial',
        test: path.resolve(__dirname, 'node_modules'),
        enforce: true,
      },
    },
  },
}

it shows me the "No tests found in your file", however if I remove that config everything works fine!

@LinusBorg
Copy link

LinusBorg commented Oct 16, 2018

Contributor of vue-cli here (the project that the reproduction is built on).

We recently found that doing any sort of code splitting with webpack 4 optimization breaks the cypress preprocessor.

We did a quick fix in our own webpack config:

vuejs/vue-cli@ab0503b

But when users lik OP overwrites this config, it breaks again.

So I think we should investigate how codesplit chunks break the preprocessor.

@leeuwd
Copy link

leeuwd commented Oct 16, 2018

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

@paxcodes
Copy link

paxcodes commented Feb 2, 2020

Thanks to @LinusBorg comment. I just have to disable code splitting for now in my webpack config.

@jennifer-shehane
Copy link
Member

Closing as resolved.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@jennifer-shehane jennifer-shehane removed the stage: awaiting external fix A 3rd party bug in Cypress - awaiting release label Jul 13, 2020
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

8 participants