fix: vitest config

This commit is contained in:
Chareice 2024-03-31 19:13:58 +08:00
parent 79f14d9024
commit 3409a113dc
No known key found for this signature in database

View File

@ -186,20 +186,24 @@ export const defineConfig = () => {
const isServer = process.env.TEST_ENV === 'server-side';
const config = vitestConfig(mergeConfig(defineCommonConfig(), isServer ? defineServerConfig() : defineClientConfig()));
const filterInclude = getFilterInclude(isServer);
if (filterInclude) {
config.test.include = getFilterInclude(isServer);
}
const isCoverage = process.argv.includes('--coverage');
if (!isCoverage) {
return config;
}
const filterInclude = getFilterInclude(isServer);
if (filterInclude) {
config.test.include = getFilterInclude(isServer);
}
config.test.coverage.include = getFilterInclude(isServer, true);
const reportsDirectory = getReportsDirectory(isServer);
if (reportsDirectory) {
config.test.coverage.reportsDirectory = reportsDirectory;
}
return config;
};