midscene/packages/web-integration/vitest.config.ts
Zhou xiao eafa5bfa20
feat(cache): The cache is generalized to support puppeteers and mobile terminals (#85)
* feat(cache): The cache is generalized to support Puppeteers and mobile terminals

* chore: update cache test

* chore: update cache test

* chore: update cache test

* docs: update cache doc

* chore: update ai test command

* chore: update ai test command

* chore: update ai test command

* chore: optimize cache logic

* chore: update get dir path logic

* chore: update get dir path logic
2024-09-06 17:19:35 +08:00

40 lines
907 B
TypeScript

import path from 'node:path';
//@ts-ignore
import dotenv from 'dotenv';
import { defineConfig } from 'vitest/config';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
dotenv.config({
path: path.join(__dirname, '../../.env'),
});
const aiTestType = process.env.AI_TEST_TYPE;
const unitTests = ['tests/unit-test/*.test.ts'];
const aiWebTests = ['tests/ai/web/**/*.test.ts'];
const aiNativeTests = ['tests/ai/native/**/*.test.ts'];
// const aiNativeTests = ['tests/ai/native/appium/dongchedi.test.ts'];
const testFiles = (() => {
switch (aiTestType) {
case 'web':
return [...unitTests, ...aiWebTests];
case 'native':
return [...aiNativeTests];
default:
return unitTests;
}
})();
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
test: {
include: testFiles,
},
});