karma.conf.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Password Management Servlets (PWM)
  3. * http://www.pwm-project.org
  4. *
  5. * Copyright (c) 2006-2009 Novell, Inc.
  6. * Copyright (c) 2009-2021 The PWM Project
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. var webpack = require('webpack');
  21. var webpackConfig = require('../webpack.config.js')({}, {});
  22. var path = require("path");
  23. var os = require('os');
  24. module.exports = function (config) {
  25. config.set({
  26. // base path that will be used to resolve all patterns (eg. files, exclude)
  27. basePath: '..',
  28. // frameworks to use
  29. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  30. frameworks: [ 'jasmine' ],
  31. // list of files / patterns to load in the browser
  32. files: [
  33. 'test/karma-test-suite.ts'
  34. ],
  35. exclude: [],
  36. // preprocess matching files before serving them to the browser
  37. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  38. preprocessors: {
  39. "**/*.ts": ["webpack", "sourcemap"]
  40. },
  41. // fix typescript serving video/mp2t mime type
  42. mime: {
  43. 'text/x-typescript': ['ts', 'tsx']
  44. },
  45. webpack: {
  46. mode: 'development',
  47. devtool: 'inline-source-map',
  48. resolve: webpackConfig.resolve,
  49. module: webpackConfig.module,
  50. optimization: {
  51. minimize: false
  52. }
  53. },
  54. webpackMiddleware: {
  55. // display no info to console (only warnings and errors)
  56. noInfo: true,
  57. stats: {
  58. colors: true
  59. }
  60. },
  61. // test results reporter to use
  62. // possible values: 'dots', 'progress'
  63. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  64. reporters: ['kjhtml', 'spec'],
  65. // web server port
  66. port: 9876,
  67. // enable / disable colors in the output (reporters and logs)
  68. colors: true,
  69. // level of logging
  70. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  71. logLevel: config.LOG_INFO,
  72. // enable / disable watching file and executing tests whenever any file changes
  73. autoWatch: true,
  74. // start these browsers
  75. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  76. browsers: ['Chrome_with_debug_plugins'],
  77. // Provides the ability to install plugins in Chrome (such as JetBrains debugger), and have them stick around
  78. // between launches:
  79. customLaunchers: {
  80. Chrome_with_debug_plugins: {
  81. base: 'Chrome',
  82. chromeDataDir: path.resolve(os.homedir(), '.karma/customLaunchers/Chrome_with_debug_plugins')
  83. }
  84. },
  85. // Continuous Integration mode
  86. // if true, Karma captures browsers, runs the tests and exits
  87. singleRun: false,
  88. // Concurrency level
  89. // how many browser should be started simultaneous
  90. concurrency: Infinity
  91. })
  92. };