karma.conf.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Karma configuration
  2. // Generated on Thu Nov 23 2017 22:01:37 GMT+0800 (中国标准时间)
  3. var path = require("path");
  4. var webpack = require("webpack");
  5. module.exports = function(config) {
  6. config.set({
  7. // base path that will be used to resolve all patterns (eg. files, exclude)
  8. basePath: '',
  9. // frameworks to use
  10. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  11. frameworks: ['jasmine'],
  12. // list of files / patterns to load in the browser
  13. files: [
  14. 'test/*.js',
  15. 'test/**/*.js',
  16. 'test/**/*.jsx',
  17. // 'test/**/ReactComponentLifeCycle-test.jsx',
  18. ],
  19. // list of files to exclude
  20. exclude: [
  21. ],
  22. // preprocess matching files before serving them to the browser
  23. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  24. preprocessors: {
  25. 'test/**/*.js': ['webpack'],
  26. 'test/**/*.jsx': ['webpack'],
  27. },
  28. // test results reporter to use
  29. // possible values: 'dots', 'progress'
  30. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  31. reporters: ['progress'],
  32. // web server port
  33. port: 9876,
  34. webpack: {
  35. module: {
  36. /* Transpile source and test files */
  37. rules: [{
  38. test: /\.jsx?$/,
  39. use: "babel-loader",
  40. }]
  41. }
  42. },
  43. // enable / disable colors in the output (reporters and logs)
  44. colors: true,
  45. // level of logging
  46. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  47. logLevel: config.LOG_INFO,
  48. // enable / disable watching file and executing tests whenever any file changes
  49. autoWatch: true,
  50. // start these browsers
  51. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  52. browsers: [],
  53. // Continuous Integration mode
  54. // if true, Karma captures browsers, runs the tests and exits
  55. singleRun: false,
  56. // Concurrency level
  57. // how many browser should be started simultaneous
  58. concurrency: Infinity
  59. })
  60. }