vitest.config.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { config } from "dotenv";
  6. import path from 'path';
  7. import { defineConfig } from 'vitest/config';
  8. export default defineConfig({
  9. build: {
  10. commonjsOptions: {
  11. transformMixedEsModules: true,
  12. },
  13. },
  14. resolve: {
  15. alias: [
  16. {find: "@application", replacement: path.resolve(__dirname, './src/application') },
  17. {find: "@workflow", replacement: path.resolve(__dirname, './src/domain') },
  18. {find: "@infra", replacement: path.resolve(__dirname, './src/infrastructure') },
  19. {find: "@nodes", replacement: path.resolve(__dirname, './src/nodes') },
  20. ],
  21. },
  22. test: {
  23. globals: true,
  24. mockReset: false,
  25. environment: 'jsdom',
  26. testTimeout: 15000,
  27. setupFiles: [path.resolve(__dirname, './src/domain/__tests__/setup.ts')],
  28. include: ['**/?(*.){test,spec}.?(c|m)[jt]s?(x)'],
  29. exclude: [
  30. '**/__mocks__**',
  31. '**/node_modules/**',
  32. '**/dist/**',
  33. '**/lib/**', // lib 编译结果忽略掉
  34. '**/cypress/**',
  35. '**/.{idea,git,cache,output,temp}/**',
  36. '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
  37. ],
  38. env: {
  39. ...config({ path: path.resolve(__dirname, './.env/.env.test') }).parsed
  40. }
  41. },
  42. });