karma.conf.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Karma configuration
  2. // The Safari launcher is broken, so construct our own
  3. function SafariBrowser(id, baseBrowserDecorator, args) {
  4. baseBrowserDecorator(this);
  5. this._start = function(url) {
  6. this._execCommand('/usr/bin/open', ['-W', '-n', '-a', 'Safari', url]);
  7. }
  8. }
  9. SafariBrowser.prototype = {
  10. name: 'Safari'
  11. }
  12. module.exports = (config) => {
  13. let browsers = [];
  14. if (process.env.TEST_BROWSER_NAME) {
  15. browsers = process.env.TEST_BROWSER_NAME.split(',');
  16. }
  17. const my_conf = {
  18. // base path that will be used to resolve all patterns (eg. files, exclude)
  19. basePath: '',
  20. // frameworks to use
  21. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  22. frameworks: ['mocha', 'sinon-chai'],
  23. // list of files / patterns to load in the browser (loaded in order)
  24. files: [
  25. { pattern: 'app/localization.js', included: false, type: 'module' },
  26. { pattern: 'app/webutil.js', included: false, type: 'module' },
  27. { pattern: 'core/**/*.js', included: false, type: 'module' },
  28. { pattern: 'vendor/pako/**/*.js', included: false, type: 'module' },
  29. { pattern: 'tests/test.*.js', type: 'module' },
  30. { pattern: 'tests/fake.*.js', included: false, type: 'module' },
  31. { pattern: 'tests/assertions.js', type: 'module' },
  32. ],
  33. client: {
  34. mocha: {
  35. // replace Karma debug page with mocha display
  36. 'reporter': 'html',
  37. 'ui': 'bdd'
  38. }
  39. },
  40. // list of files to exclude
  41. exclude: [
  42. ],
  43. plugins: [
  44. 'karma-*',
  45. '@chiragrupani/karma-chromium-edge-launcher',
  46. { 'launcher:Safari': [ 'type', SafariBrowser ] },
  47. ],
  48. // start these browsers
  49. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  50. browsers: browsers,
  51. // test results reporter to use
  52. // possible values: 'dots', 'progress'
  53. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  54. reporters: ['mocha'],
  55. // level of logging
  56. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  57. logLevel: config.LOG_INFO,
  58. // enable / disable watching file and executing tests whenever any file changes
  59. autoWatch: false,
  60. // Continuous Integration mode
  61. // if true, Karma captures browsers, runs the tests and exits
  62. singleRun: true,
  63. };
  64. config.set(my_conf);
  65. };