jest-config.ts 874 B

123456789101112131415161718192021222324252627
  1. import path = require('path');
  2. module.exports = function(baseDir: string) {
  3. return {
  4. preset: 'ts-jest/presets/js-with-babel',
  5. moduleNameMapper: {
  6. '\\.(css|less|sass|scss)$': 'identity-obj-proxy',
  7. '\\.(gif|ttf|eot)$': '@jupyterlab/testutils/lib/jest-file-mock.js'
  8. },
  9. transform: {
  10. '\\.svg$': 'jest-raw-loader',
  11. '^.+\\.md?$': 'markdown-loader-jest'
  12. },
  13. setupFiles: ['@jupyterlab/testutils/lib/jest-shim.js'],
  14. testPathIgnorePatterns: ['/lib/', '/node_modules/'],
  15. moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
  16. reporters: ['default', 'jest-junit'],
  17. coverageReporters: ['json', 'lcov', 'text', 'html'],
  18. coverageDirectory: path.join(baseDir, 'coverage'),
  19. testRegex: '/test/.*.spec.ts[x]?$',
  20. globals: {
  21. 'ts-jest': {
  22. tsConfig: `./tsconfig.test.json`
  23. }
  24. }
  25. };
  26. };