jest.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. __RUNTIME_COMPILE__: true,
  9. __GLOBAL__: false,
  10. __NODE_JS__: true,
  11. __FEATURE_OPTIONS__: true,
  12. __FEATURE_SUSPENSE__: true
  13. },
  14. coverageDirectory: 'coverage',
  15. coverageReporters: ['html', 'lcov', 'text'],
  16. collectCoverageFrom: [
  17. 'packages/*/src/**/*.ts',
  18. '!packages/runtime-test/src/utils/**',
  19. '!packages/template-explorer/**',
  20. '!packages/size-check/**',
  21. '!packages/runtime-core/src/profiling.ts'
  22. ],
  23. watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
  24. moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
  25. moduleNameMapper: {
  26. '^@vue/(.*?)$': '<rootDir>/packages/$1/src',
  27. vue: '<rootDir>/packages/vue/src'
  28. },
  29. rootDir: __dirname,
  30. testMatch: ['<rootDir>/packages/**/__tests__/**/*spec.[jt]s?(x)'],
  31. testPathIgnorePatterns: process.env.SKIP_E2E
  32. ? // ignore example tests on netlify builds since they don't contribute
  33. // to coverage and can cause netlify builds to fail
  34. ['/node_modules/', '/examples/__tests__']
  35. : ['/node_modules/']
  36. }