vitest.config.ts 841 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. const path = require('path');
  6. import { defineConfig } from 'vitest/config';
  7. export default defineConfig({
  8. build: {
  9. commonjsOptions: {
  10. transformMixedEsModules: true,
  11. },
  12. },
  13. test: {
  14. coverage: {
  15. exclude: ['setup/**', '**/*.mock.*'],
  16. },
  17. globals: true,
  18. mockReset: false,
  19. environment: 'jsdom',
  20. include: ['**/?(*.){test,spec}.?(c|m)[jt]s?(x)'],
  21. setupFiles: [path.resolve(__dirname, './vitest.setup.ts')],
  22. exclude: [
  23. '**/node_modules/**',
  24. '**/dist/**',
  25. '**/lib/**', // lib 编译结果忽略掉
  26. '**/cypress/**',
  27. '**/.{idea,git,cache,output,temp}/**',
  28. '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
  29. ],
  30. },
  31. });