jest.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module.exports = {
  2. moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'ts', 'tsx'],
  3. transform: {
  4. '^.+\\.vue$': 'vue-jest',
  5. '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
  6. '^.+\\.(js|jsx)?$': 'ts-jest',
  7. },
  8. preset: 'ts-jest/presets/js-with-ts',
  9. transformIgnorePatterns: [
  10. '/node_modules/(?!(' +
  11. 'babel-jest|' +
  12. 'jest-vue-preprocessor|' +
  13. 'bootstrap-vue|' +
  14. 'vuex-i18n|' +
  15. 'vue-awesome|' +
  16. 'vue-flag-icon|' +
  17. 'flag-icon-css|' +
  18. 'vue-lottie|' +
  19. ')/)',
  20. ],
  21. // transformIgnorePatterns: ['/node_modules/'],
  22. moduleNameMapper: {
  23. '^@/(.*)$': '<rootDir>/src/$1',
  24. '^@@/(.*)$': '<rootDir>/src/thirdparty/eshop/$1',
  25. '^@@@/(.*)$': '<rootDir>/src/thirdparty/placement-tree-viewer/$1',
  26. '^@@@@/(.*)$': '<rootDir>/src/thirdparty/payment/$1',
  27. '^@AppCenter/(.*)$': '<rootDir>/src/thirdparty/elken-app-center/$1',
  28. },
  29. snapshotSerializers: ['jest-serializer-vue'],
  30. testMatch: ['**/tests/unit/**/*.spec.(js|jsx|ts|tsx)', '**/__tests__/*.(js|jsx|ts|tsx)'],
  31. testURL: 'http://localhost/',
  32. watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
  33. globals: {
  34. 'ts-jest': {
  35. babelConfig: true,
  36. },
  37. },
  38. setupFiles: ['./tests/test-env.js'],
  39. setupFilesAfterEnv: ['./tests/test-setup.js'], // runs before each test
  40. }