Issue: While running vitest, it runs cypress test cases as well. #2272
Replies: 1 comment
-
I think after some digging, came to know that we can add include / exclude props under test object in vite.config.js. Below is my working config. Please note, excluding '**/*.{spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}' does not work, I think this is due to the directory level matching problem. Therefore, I have just added my Cypress root directory and it excluded cypress when runs vitest. In addition, I would also like to add that, Cypress was looking for the given file format - ***.cy.{js,jsx,ts,tsx}. If it does not match with the format, it will give error. export default defineConfig({
} |
Beta Was this translation helpful? Give feedback.
-
Does anyone will be able to help me to find the way to run only unit test cases, not e2e test cases when execute "vitest run" ?
Expected; I would like to execute only unit test cases not e2e test cases.
Actual: It execute both unit test as well as e2e test cases.
please note, I have separate command in package.json to run cypress separately. Thus don't want vitest to run cypress.
package.json
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"test": "vitest run",
"e2e": "Cypress run"
},
vite.config.js
export default defineConfig({
plugins: [vue()],
test: {
globals: true,
environment: "jsdom",
coverage: {
provider: "c8",
reporter: ['text', 'html'],
exclude: ['node_modules']
}
}
})
Beta Was this translation helpful? Give feedback.
All reactions