karma.conf.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Karma configuration
  2. // Generated on Tue Mar 08 2016 13:37:35 GMT+0800 (CST)
  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 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. 'test/**/*.js'
  13. ],
  14. // list of files to exclude
  15. exclude: [
  16. ],
  17. // preprocess matching files before serving them to the browser
  18. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  19. preprocessors: {
  20. 'test/**/*.js': ['rollup']
  21. },
  22. rollupPreprocessor: {
  23. rollup: {
  24. plugins: [
  25. require('rollup-plugin-babel')({
  26. exclude: 'node_modules/**',
  27. presets: [
  28. require('babel-preset-es2015-rollup')
  29. ]
  30. }),
  31. require('rollup-plugin-node-resolve')({
  32. jsnext: true,
  33. main: true
  34. }),
  35. require('rollup-plugin-commonjs')(),
  36. require('rollup-plugin-env')({})
  37. ]
  38. },
  39. bundle: {
  40. sourceMap: 'inline'
  41. }
  42. },
  43. // test results reporter to use
  44. // possible values: 'dots', 'progress'
  45. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  46. reporters: ['progress'],
  47. // web server port
  48. port: 9876,
  49. // enable / disable colors in the output (reporters and logs)
  50. colors: true,
  51. // level of logging
  52. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  53. logLevel: config.LOG_INFO,
  54. // enable / disable watching file and executing tests whenever any file changes
  55. autoWatch: true,
  56. // start these browsers
  57. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  58. browsers: ['PhantomJS_custom'],
  59. // you can define custom flags
  60. customLaunchers: {
  61. 'PhantomJS_custom': {
  62. base: 'PhantomJS',
  63. options: {
  64. viewportSize: { width: 480, height: 800 }
  65. }
  66. }
  67. },
  68. phantomjsLauncher: {
  69. // Have phantomjs exit if a ResourceError is encountered (useful if karma exits without killing phantom)
  70. exitOnResourceError: true
  71. },
  72. // Continuous Integration mode
  73. // if true, Karma captures browsers, runs the tests and exits
  74. singleRun: true,
  75. // Concurrency level
  76. // how many browser should be started simultaneous
  77. concurrency: Infinity
  78. })
  79. }