Home > Back-end >  Vue Cypress Component Test Runner - location of test files
Vue Cypress Component Test Runner - location of test files

Time:12-04

I've added the Cypress Vue Component Test runner to an existing Vue app and I want all the test files to be in the same directory as the components. However, whatever I put in my cypress.json file seems to be ignored and cypress always wants to look in the default integration folder.

In my cypress.json file I have:

{
    "component": {
      "componentFolder": "src",
      "testFiles": "**/*.spec.ts",
      "testMatch": [
        "**/src/**/*.spec.[jt]s?(x)"
      ]
    },
}

but when I run

npm run cy:run:chrome

I get:

> [email protected] cy:run:chrome
> cypress run --browser chrome

Can't run because no spec files were found.

We searched for any files inside of this folder:

/Users/richardshergold/Projects/vue-myapp/cypress/integration

CodePudding user response:

You can change the default folder that Cypress looks in for tests using integrationFolder in your cypress.json. This value defaults to cypress/integration.

Even when adding a testFiles field, Cypress will restrict that search to the integrationFolder value.

...
"integrationFolder": "/path/to/tests/folder",
...
  • Related