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.

95 lines
2.6 KiB

  1. /*
  2. * @copyright Copyright (c) 2020 Marco Ambrosini <marcoambrosini@icloud.com>
  3. *
  4. * @author Marco Ambrosini <marcoambrosini@icloud.com>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. const { resolve } = require('node:path')
  23. // TODO: find a way to consolidate this in one place, with webpack.common.js
  24. const ignorePatterns = [
  25. '(vue-material-design-icons)',
  26. '(@juliushaertl)',
  27. '(tributejs)',
  28. '(@nextcloud/vue)',
  29. '(splitpanes)',
  30. '(string-length)',
  31. '(strip-ansi)',
  32. '(ansi-regex)',
  33. '(char-regex)',
  34. '(uuid)',
  35. '(unist*)',
  36. '(unified)',
  37. '(bail)',
  38. '(remark*)',
  39. '(is-*)',
  40. '(trough)',
  41. '(vfile)',
  42. '(mdast*)',
  43. '(micromark)',
  44. '(decode-named-character-reference)',
  45. '(trim-lines)',
  46. '(rehype*)',
  47. '(hast-*)',
  48. '(property-information)',
  49. '(space-separated-tokens)',
  50. '(comma-separated-tokens)',
  51. '(web-namespaces)',
  52. ]
  53. module.exports = {
  54. // Allow tests in the src and in tests/unit folders
  55. testMatch: ['<rootDir>/src/**/*.(spec|test).(ts|js)'],
  56. transformIgnorePatterns: [
  57. 'node_modules/(?!' + ignorePatterns.join('|') + '/)',
  58. ],
  59. resetMocks: false,
  60. setupFiles: ['jest-localstorage-mock'],
  61. setupFilesAfterEnv: [
  62. '<rootDir>/src/test-setup.js',
  63. 'jest-mock-console/dist/setupTestFramework.js',
  64. ],
  65. globalSetup: resolve(__dirname, 'jest.global.setup.js'),
  66. collectCoverageFrom: [
  67. '<rootDir>/src/**/*.{js,vue}',
  68. ],
  69. testEnvironment: 'jest-environment-jsdom',
  70. moduleFileExtensions: [
  71. 'js',
  72. 'vue',
  73. ],
  74. moduleNameMapper: {
  75. '\\.(css|scss)$': 'jest-transform-stub',
  76. 'vendor/tflite/(.*).wasm$': '<rootDir>/src/utils/media/effects/virtual-background/vendor/tflite/$1.js',
  77. // Axios using ESM since v1.0.0, so we need to replace it with CJS for tests
  78. axios: '<rootDir>/node_modules/@nextcloud/axios/node_modules/axios/dist/node/axios.cjs',
  79. },
  80. transform: {
  81. '\\.js$': 'babel-jest',
  82. '\\.vue$': '@vue/vue2-jest',
  83. '\\.tflite$': 'jest-transform-stub',
  84. '\\.(css|scss)$': 'jest-transform-stub',
  85. },
  86. }