2022-04-07 16:41:17 +08:00
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
import { getHookFiles } from './packages/ice/esm/requireHook.js';
|
|
|
|
|
|
|
|
const moduleNameMapper = getHookFiles().reduce((mapper, [id, value]) => {
|
|
|
|
mapper[`^${id}$`] = value;
|
|
|
|
return mapper;
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
resolve: {
|
|
|
|
alias: { ...moduleNameMapper },
|
|
|
|
},
|
|
|
|
test: {
|
2022-11-22 16:43:03 +08:00
|
|
|
testTimeout: 120000,
|
2024-03-20 14:44:21 +08:00
|
|
|
hookTimeout: 120000,
|
2022-04-14 17:16:51 +08:00
|
|
|
// To avoid error `Segmentation fault (core dumped)` in CI environment, disable threads
|
|
|
|
// ref: https://github.com/vitest-dev/vitest/issues/317
|
2022-04-07 16:41:17 +08:00
|
|
|
threads: false,
|
|
|
|
exclude: [
|
|
|
|
'**/node_modules/**',
|
|
|
|
'**/esm/**',
|
|
|
|
'**/tests/fixtures/**',
|
2022-09-16 14:32:38 +08:00
|
|
|
'examples/**',
|
2022-04-07 16:41:17 +08:00
|
|
|
],
|
2022-06-22 19:43:56 +08:00
|
|
|
coverage: {
|
|
|
|
reporter: ['cobertura', 'text'],
|
|
|
|
include: ['**/packages/**'],
|
|
|
|
exclude: [
|
|
|
|
'**/bundles/compiled/**',
|
2022-09-07 14:49:54 +08:00
|
|
|
// App runtime has been tested by unit test case
|
|
|
|
'**/packages/runtime/esm/**',
|
2022-10-14 17:19:57 +08:00
|
|
|
'**/packages/route-manifest/esm/**',
|
2022-09-23 11:11:38 +08:00
|
|
|
'**/packages/miniapp-runtime/esm/**',
|
2022-06-22 19:43:56 +08:00
|
|
|
'**/tests/**',
|
|
|
|
],
|
|
|
|
},
|
2022-11-14 15:59:22 +08:00
|
|
|
environment: 'node',
|
2022-04-07 16:41:17 +08:00
|
|
|
},
|
2022-06-29 17:39:47 +08:00
|
|
|
mode: 'test',
|
2022-04-14 17:16:51 +08:00
|
|
|
});
|