module.exports = {
  moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'ts', 'tsx'],
  transform: {
    '^.+\\.vue$': 'vue-jest',
    '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
    '^.+\\.(js|jsx)?$': 'ts-jest',
  },
  preset: 'ts-jest/presets/js-with-ts',
  transformIgnorePatterns: [
    '/node_modules/(?!(' +
      'babel-jest|' +
      'jest-vue-preprocessor|' +
      'bootstrap-vue|' +
      'vuex-i18n|' +
      'vue-awesome|' +
      'vue-flag-icon|' +
      'flag-icon-css|' +
      'vue-lottie|' +
      ')/)',
  ],
  // transformIgnorePatterns: ['/node_modules/'],
  moduleNameMapper: {
    '^@/(.*)$': '<rootDir>/src/$1',
    '^@@/(.*)$': '<rootDir>/src/thirdparty/eshop/$1',
    '^@@@/(.*)$': '<rootDir>/src/thirdparty/placement-tree-viewer/$1',
    '^@@@@/(.*)$': '<rootDir>/src/thirdparty/payment/$1',
    '^@AppCenter/(.*)$': '<rootDir>/src/thirdparty/elken-app-center/$1',
  },
  snapshotSerializers: ['jest-serializer-vue'],
  testMatch: ['**/tests/unit/**/*.spec.(js|jsx|ts|tsx)', '**/__tests__/*.(js|jsx|ts|tsx)'],
  testURL: 'http://localhost/',
  watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
  globals: {
    'ts-jest': {
      babelConfig: true,
    },
  },
  setupFiles: ['./tests/test-env.js'],
  setupFilesAfterEnv: ['./tests/test-setup.js'], // runs before each test
}
