karma.conf.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Karma configuration
  2. 'use strict'
  3. module.exports = (config) => {
  4. config.set({
  5. // base path that will be used to resolve all patterns (eg. files, exclude)
  6. basePath: '',
  7. // frameworks to use
  8. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  9. frameworks: ['jasmine'],
  10. // list of files / patterns to load in the browser
  11. files: [
  12. 'node_modules/adler32cs/adler32cs.js',
  13. 'libs/deflate.js',
  14. 'libs/html2canvas/dist/html2canvas.js',
  15. 'jspdf.js',
  16. 'plugins/acroform.js',
  17. 'plugins/annotations.js',
  18. 'plugins/split_text_to_size.js',
  19. 'plugins/standard_fonts_metrics.js',
  20. 'plugins/autoprint.js',
  21. 'plugins/addhtml.js',
  22. 'plugins/addimage.js',
  23. 'tests/utils/compare.js',
  24. {
  25. pattern: 'tests/**/*.spec.js',
  26. included: true
  27. }, {
  28. pattern: 'tests/**/reference/*.pdf',
  29. included: false,
  30. served: true
  31. }
  32. ],
  33. // list of files to exclude
  34. exclude: [],
  35. // preprocess matching files before serving them to the browser
  36. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  37. preprocessors: {
  38. 'jspdf.js': 'coverage',
  39. 'plugins/*.js': 'coverage',
  40. 'tests/!(acroform)*/*.js': 'babel'
  41. },
  42. // test results reporter to use
  43. // possible values: 'dots', 'progress'
  44. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  45. reporters: ['mocha', 'coverage'],
  46. // web server port
  47. port: 9876,
  48. // enable / disable colors in the output (reporters and logs)
  49. colors: true,
  50. // level of logging
  51. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  52. logLevel: config.LOG_INFO,
  53. // enable / disable watching file and executing tests whenever any file changes
  54. autoWatch: true,
  55. // start these browsers
  56. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  57. browsers: ['Chrome', 'Firefox'],
  58. // Continuous Integration mode
  59. // if true, Karma captures browsers, runs the tests and exits
  60. singleRun: false,
  61. // Concurrency level
  62. // how many browser should be started simultaneous
  63. concurrency: Infinity,
  64. coverageReporter: {
  65. reporters: [
  66. {
  67. type: 'lcov',
  68. dir: 'coverage/'
  69. },
  70. {
  71. type: 'text'
  72. }
  73. ]
  74. },
  75. babelPreprocessor: {
  76. options: {
  77. presets: ['es2015'],
  78. sourceMap: 'inline'
  79. }
  80. }
  81. })
  82. }