jest.config.js 1.4 KB

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