You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. import type { Config } from 'jest'
  6. // TODO: find a way to consolidate this in one place, with webpack.common.js
  7. const ignorePatterns = [
  8. '@buttercup/fetch',
  9. '@juliushaertl',
  10. '@mdi/svg',
  11. '@nextcloud/upload',
  12. '@nextcloud/vue',
  13. 'ansi-regex',
  14. 'camelcase',
  15. 'char-regex',
  16. 'hot-patcher',
  17. 'is-svg',
  18. 'mime',
  19. 'p-cancelable',
  20. 'p-limit',
  21. 'p-queue',
  22. 'p-timeout',
  23. 'splitpanes',
  24. 'string-length',
  25. 'strip-ansi',
  26. 'tributejs',
  27. 'unist-.+',
  28. 'vue-material-design-icons',
  29. 'webdav',
  30. 'yocto-queue',
  31. ]
  32. const config: Config = {
  33. testMatch: ['<rootDir>/**/*.(spec|test).(ts|js)'],
  34. clearMocks: true,
  35. setupFilesAfterEnv: ['<rootDir>/__tests__/jest-setup.ts'],
  36. testEnvironment: 'jest-environment-jsdom',
  37. preset: 'ts-jest/presets/js-with-ts',
  38. roots: [
  39. '<rootDir>/__mocks__',
  40. '<rootDir>/__tests__',
  41. '<rootDir>/apps',
  42. '<rootDir>/core',
  43. ],
  44. transform: {
  45. // process `*.js` files with `babel-jest`
  46. '^.+\\.js$': 'babel-jest',
  47. '^.+\\.vue$': '@vue/vue2-jest',
  48. '^.+\\.ts$': ['ts-jest', {
  49. // @see https://github.com/kulshekhar/ts-jest/issues/4081
  50. tsconfig: './__tests__/tsconfig.json',
  51. }],
  52. },
  53. transformIgnorePatterns: [
  54. 'node_modules/(?!(' + ignorePatterns.join('|') + ')/)',
  55. ],
  56. // Allow mocking svg files
  57. moduleNameMapper: {
  58. '^.+\\.svg(\\?raw)?$': '<rootDir>/__mocks__/svg.js',
  59. '\\.s?css$': '<rootDir>/__mocks__/css.js',
  60. },
  61. modulePathIgnorePatterns: [
  62. '<rootDir>/apps2/',
  63. '<rootDir>/apps-extra/',
  64. ],
  65. }
  66. export default config