karma.conf.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* global module */
  2. const path = require('path');
  3. module.exports = function(config) {
  4. config.set({
  5. // base path that will be used to resolve all patterns (eg. files, exclude)
  6. basePath: '',
  7. frameworks: ['jasmine'],
  8. files: [
  9. { pattern: 'dist/*.js.map', included: false },
  10. { pattern: 'dist/*.css.map', included: false },
  11. { pattern: 'src/headless/dist/*.js.map', included: false },
  12. {
  13. pattern: "dist/emoji.json",
  14. watched: false,
  15. included: false,
  16. served: true,
  17. type: 'json'
  18. },
  19. "src/shared/tests/tests.css",
  20. "dist/converse.js",
  21. "dist/converse.css",
  22. { pattern: "dist/images/**/*.*", included: false },
  23. { pattern: "dist/webfonts/**/*.*", included: false },
  24. { pattern: "logo/conversejs-filled.svg",
  25. watched: false,
  26. included: false,
  27. served: true,
  28. nocache: false
  29. },
  30. { pattern: "logo/conversejs-filled-192.svg",
  31. watched: false,
  32. included: false,
  33. served: true,
  34. nocache: false
  35. },
  36. { pattern: "logo/conversejs-filled-192.png",
  37. watched: false,
  38. included: false,
  39. served: true,
  40. nocache: false
  41. },
  42. { pattern: "src/shared/tests/mock.js", type: 'module' },
  43. { pattern: "src/headless/tests/mock.js", type: 'module' },
  44. // Ideally this should go into the headless test runner
  45. { pattern: "src/headless/plugins/vcard/tests/update.js", type: 'module' },
  46. { pattern: "src/i18n/tests/i18n.js", type: 'module' },
  47. { pattern: "src/plugins/adhoc-views/tests/*.js", type: 'module' },
  48. { pattern: "src/plugins/bookmark-views/tests/*.js", type: 'module' },
  49. { pattern: "src/plugins/chatview/tests/*.js", type: 'module' },
  50. { pattern: "src/plugins/controlbox/tests/*.js", type: 'module' },
  51. { pattern: "src/plugins/disco-views/tests/*.js", type: 'module' },
  52. { pattern: "src/plugins/headlines-view/tests/*.js", type: 'module' },
  53. { pattern: "src/plugins/mam-views/tests/*.js", type: 'module' },
  54. { pattern: "src/plugins/minimize/tests/*.js", type: 'module' },
  55. { pattern: "src/plugins/muc-views/tests/*.js", type: 'module' },
  56. { pattern: "src/plugins/notifications/tests/*.js", type: 'module' },
  57. { pattern: "src/plugins/omemo-views/tests/*.js", type: 'module' },
  58. { pattern: "src/plugins/profile/tests/*.js", type: 'module' },
  59. { pattern: "src/plugins/push/tests/*.js", type: 'module' },
  60. { pattern: "src/plugins/register/tests/*.js", type: 'module' },
  61. { pattern: "src/plugins/roomslist/tests/*.js", type: 'module' },
  62. { pattern: "src/plugins/rootview/tests/*.js", type: 'module' },
  63. { pattern: "src/plugins/rosterview/tests/*.js", type: 'module' },
  64. { pattern: "src/plugins/rosterview/tests/requesting_contacts.js", type: 'module' },
  65. { pattern: "src/shared/modals/tests/*.js", type: 'module' },
  66. { pattern: "src/utils/tests/*.js", type: 'module' },
  67. ],
  68. proxies: {
  69. "/dist/emoji.json": "/base/dist/emoji.json",
  70. "/dist/images/custom_emojis/": "/base/dist/images/custom_emojis/",
  71. "/images/logo/": "/base/dist/images/logo/"
  72. },
  73. client: {
  74. jasmine: {
  75. random: false
  76. }
  77. },
  78. exclude: ['**/*.sw?'],
  79. // preprocess matching files before serving them to the browser
  80. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  81. preprocessors: {},
  82. // test results reporter to use
  83. // possible values: 'dots', 'progress'
  84. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  85. reporters: ['progress', 'kjhtml'],
  86. webpack: {
  87. mode: 'development',
  88. devtool: 'inline-source-map',
  89. module: {
  90. rules: [{
  91. test: /\.js$/,
  92. exclude: /(node_modules|test)/
  93. }]
  94. },
  95. output: {
  96. path: path.resolve('test'),
  97. filename: '[name].out.js',
  98. chunkFilename: '[id].[chunkHash].js'
  99. }
  100. },
  101. port: 9876,
  102. colors: true,
  103. // level of logging
  104. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  105. logLevel: config.LOG_INFO,
  106. // enable / disable watching file and executing tests whenever any file changes
  107. autoWatch: true,
  108. // start these browsers
  109. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  110. browsers: ['Chrome'],
  111. // Continuous Integration mode
  112. // if true, Karma captures browsers, runs the tests and exits
  113. singleRun: false,
  114. // Concurrency level
  115. // how many browser should be started simultaneous
  116. concurrency: Infinity
  117. })
  118. }