karma.conf.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Password Management Servlets (PWM)
  3. * http://www.pwm-project.org
  4. *
  5. * Copyright (c) 2006-2009 Novell, Inc.
  6. * Copyright (c) 2009-2018 The PWM Project
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. var webpack = require('webpack');
  23. var webpackConfig = require('../webpack.test.js');
  24. var path = require("path");
  25. var os = require('os');
  26. module.exports = function (config) {
  27. config.set({
  28. // base path that will be used to resolve all patterns (eg. files, exclude)
  29. basePath: '..',
  30. // frameworks to use
  31. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  32. frameworks: [ 'jasmine' ],
  33. // list of files / patterns to load in the browser
  34. files: [
  35. 'karma-test-suite.ts'
  36. ],
  37. exclude: [],
  38. // preprocess matching files before serving them to the browser
  39. // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
  40. preprocessors: {
  41. "**/*.ts": ["webpack", "sourcemap"]
  42. },
  43. // fix typescript serving video/mp2t mime type
  44. mime: {
  45. 'text/x-typescript': ['ts', 'tsx']
  46. },
  47. webpack: {
  48. resolve: webpackConfig.resolve,
  49. module: webpackConfig.module,
  50. plugins: [
  51. // Without this, we're not able to debug our tests in the browser:
  52. new webpack.SourceMapDevToolPlugin({
  53. filename: null, // if no value is provided the sourcemap is inlined
  54. test: /\.(ts|js)($|\?)/i // process .js and .ts files only
  55. })
  56. ]
  57. },
  58. webpackMiddleware: {
  59. // display no info to console (only warnings and errors)
  60. noInfo: true,
  61. stats: {
  62. colors: true
  63. }
  64. },
  65. // test results reporter to use
  66. // possible values: 'dots', 'progress'
  67. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  68. reporters: ['kjhtml', 'spec'],
  69. // web server port
  70. port: 9876,
  71. // enable / disable colors in the output (reporters and logs)
  72. colors: true,
  73. // level of logging
  74. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  75. logLevel: config.LOG_INFO,
  76. // enable / disable watching file and executing tests whenever any file changes
  77. autoWatch: true,
  78. // start these browsers
  79. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  80. browsers: ['Chrome_with_debug_plugins'],
  81. // Provides the ability to install plugins in Chrome (such as JetBrains debugger), and have them stick around
  82. // between launches:
  83. customLaunchers: {
  84. Chrome_with_debug_plugins: {
  85. base: 'Chrome',
  86. chromeDataDir: path.resolve(os.homedir(), '.karma/customLaunchers/Chrome_with_debug_plugins')
  87. }
  88. },
  89. // Continuous Integration mode
  90. // if true, Karma captures browsers, runs the tests and exits
  91. singleRun: false,
  92. // Concurrency level
  93. // how many browser should be started simultaneous
  94. concurrency: Infinity
  95. })
  96. };