karma.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. var commonjs = require('rollup-plugin-commonjs');
  2. var istanbul = require('rollup-plugin-istanbul');
  3. var resolve = require('rollup-plugin-node-resolve');
  4. module.exports = function(karma) {
  5. var args = karma.args || {};
  6. karma.set({
  7. browsers: ['Firefox'],
  8. frameworks: ['jasmine'],
  9. reporters: ['spec', 'kjhtml'].concat(
  10. args.coverage ? ['coverage'] : []),
  11. files: [
  12. {pattern: './test/fixtures/**/*.js', included: false},
  13. {pattern: './test/fixtures/**/*.png', included: false},
  14. 'node_modules/chart.js/dist/Chart.js',
  15. 'test/index.js',
  16. 'src/plugin.js'
  17. ].concat(args.inputs),
  18. preprocessors: {
  19. 'test/fixtures/**/*.js': ['fixtures'],
  20. 'test/specs/**/*.js': ['rollup'],
  21. 'test/index.js': ['rollup'],
  22. 'src/plugin.js': ['rollup']
  23. },
  24. rollupPreprocessor: {
  25. format: 'umd',
  26. plugins: [
  27. resolve(),
  28. commonjs(),
  29. istanbul({
  30. include: 'src/**/*.js'
  31. })
  32. ],
  33. external: [
  34. 'chart.js'
  35. ],
  36. globals: {
  37. 'chart.js': 'Chart'
  38. }
  39. },
  40. customPreprocessors: {
  41. fixtures: {
  42. base: 'rollup',
  43. options: {
  44. format: 'iife',
  45. name: 'fixture',
  46. }
  47. }
  48. },
  49. coverageReporter: {
  50. dir: 'coverage/',
  51. reporters: [
  52. {type: 'html', subdir: 'html'},
  53. {type: 'lcovonly', subdir: '.'}
  54. ]
  55. }
  56. });
  57. };