vitest.config.ts 798 B

12345678910111213141516171819202122232425262728293031
  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. globals: true,
  15. mockReset: false,
  16. environment: 'jsdom',
  17. setupFiles: [path.resolve(__dirname, './vitest.setup.ts')],
  18. include: ['**/?(*.){test,spec}.?(c|m)[jt]s?(x)'],
  19. exclude: [
  20. '**/__mocks__**',
  21. '**/node_modules/**',
  22. '**/dist/**',
  23. '**/lib/**', // lib 编译结果忽略掉
  24. '**/cypress/**',
  25. '**/.{idea,git,cache,output,temp}/**',
  26. '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
  27. ],
  28. },
  29. });