jest.config.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. module.exports = {
  2. preset: 'ts-jest',
  3. setupFilesAfterEnv: ['./scripts/setupJestEnv.ts'],
  4. globals: {
  5. __DEV__: true,
  6. __TEST__: true,
  7. __VERSION__: require('./package.json').version,
  8. __BROWSER__: false,
  9. __GLOBAL__: false,
  10. __ESM_BUNDLER__: true,
  11. __ESM_BROWSER__: false,
  12. __NODE_JS__: true,
  13. __FEATURE_OPTIONS_API__: true,
  14. __FEATURE_SUSPENSE__: true,
  15. __FEATURE_PROD_DEVTOOLS__: false
  16. },
  17. coverageDirectory: 'coverage',
  18. coverageReporters: ['html', 'lcov', 'text'],
  19. collectCoverageFrom: [
  20. 'packages/*/src/**/*.ts',
  21. '!packages/runtime-test/src/utils/**',
  22. '!packages/template-explorer/**',
  23. '!packages/size-check/**',
  24. '!packages/runtime-core/src/profiling.ts',
  25. // DOM transitions are tested via e2e so no coverage is collected
  26. '!packages/runtime-dom/src/components/Transition*',
  27. // only called in browsers
  28. '!packages/vue/src/devCheck.ts',
  29. // only used as a build entry
  30. '!packages/vue/src/runtime.ts'
  31. ],
  32. watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
  33. moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
  34. moduleNameMapper: {
  35. '^@vue/(.*?)$': '<rootDir>/packages/$1/src',
  36. vue: '<rootDir>/packages/vue/src'
  37. },
  38. rootDir: __dirname,
  39. testMatch: ['<rootDir>/packages/**/__tests__/**/*spec.[jt]s?(x)'],
  40. testPathIgnorePatterns: process.env.SKIP_E2E
  41. ? // ignore example tests on netlify builds since they don't contribute
  42. // to coverage and can cause netlify builds to fail
  43. ['/node_modules/', '/examples/__tests__']
  44. : ['/node_modules/']
  45. }