I have a Nuxt 3 + VueJS 3 project. My package.json
is as below:
{
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"prepare": "husky install",
"lint": "eslint .",
"fix": "eslint . --fix",
"test": "vitest",
"coverage": "vitest run --coverage",
"test-ct": "playwright test -c playwright-ct.config.ts"
},
"devDependencies": {
...
...
}
}
I am using 2 testing libraries for my project, vitest and the currently experimental playwright-component-testing.
I have some test files that uses only vitest and some test files that only uses playwright component testing.
When I run the command npm run test
the vitest tests pass, but the playwright tests fail. And when I run the command npm run test-ct
it does not run any test and gives an error for the vitest test file. However, if I don't have any test files that reference the vitest then all my playwright tests pass.
QUESTION: How can I configure the testing in a way that my vitest command checks for only the vitest test files and the playwright-component-testing checks only for playwright test files and both testing can be done one after the other by using only one command?
Or please can anyone suggest a better approach to this issue.