karma.conf.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Karma configuration
  2. // Generated on Fri Jan 11 2019 20:11:14 GMT+0800 (CST)
  3. const path = require('path')
  4. module.exports = function(config) {
  5. config.set({
  6. // base path that will be used to resolve all patterns (eg. files, exclude)
  7. basePath: path.resolve(__dirname, 'test'),
  8. // frameworks to use
  9. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  10. frameworks: ['mocha'],
  11. // list of files / patterns to load in the browser
  12. files: [
  13. '../build.js',
  14. 'spec/*.spec.js',
  15. 'comp1/*',
  16. 'comp2/*',
  17. 'comp3/*',
  18. 'comp4/*',
  19. 'comp5/*',
  20. 'comp5/comp/*',
  21. 'comp7/*',
  22. 'comp8/*',
  23. 'comp8/comp/*',
  24. ],
  25. // list of files / patterns to exclude
  26. exclude: [
  27. ],
  28. // preprocess matching files before serving them to the browser
  29. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  30. preprocessors: {
  31. 'comp1/*': ['filemap'],
  32. 'comp2/*': ['filemap'],
  33. 'comp3/*': ['filemap'],
  34. 'comp4/*': ['filemap'],
  35. 'comp5/*': ['filemap'],
  36. 'comp5/comp/*': ['filemap'],
  37. 'comp7/*': ['filemap'],
  38. 'comp8/*': ['filemap'],
  39. 'comp8/comp/*': ['filemap'],
  40. 'spec/*.spec.js': ['webpack', 'dirname'],
  41. },
  42. // test results reporter to use
  43. // possible values: 'dots', 'progress'
  44. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  45. reporters: ['progress'],
  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'],
  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. webpack: {
  65. optimization: {
  66. minimize: false,
  67. },
  68. node: {
  69. __dirname: false,
  70. },
  71. },
  72. fileMapPreprocessor: {
  73. // compilerOptions
  74. maxBuffer: 5 * 1024 * 1024,
  75. },
  76. })
  77. }