sibelius
9/5/2018 - 10:25 PM

Jest config to handle both .js and .ts files

Jest config to handle both .js and .ts files

module.exports = {
  displayName: 'test',
  testPathIgnorePatterns: ['/node_modules/', './dist', './scripts'],
  coverageReporters: ['lcov', 'html'],
  setupTestFrameworkScriptFile: '<rootDir>/test/setupTestFramework.js',
  globalSetup: '<rootDir>/test/setup.js',
  globalTeardown: '<rootDir>/test/teardown.js',
  resetModules: false,
  reporters: ['default', 'jest-junit'],
  transform: {
    '^.+\\.js?$': '<rootDir>/node_modules/babel-jest',
    '^.+\\.ts?$': '<rootDir>/node_modules/babel-jest',
  },
  testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(js?|ts?)$',
  moduleFileExtensions: ['ts', 'js'],
};