github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/karma.conf.js (about) 1 // Copyright 2019 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 // Karma configuration 12 // Generated on Wed Mar 22 2017 16:39:26 GMT-0400 (EDT) 13 14 "use strict"; 15 16 const webpackConfig = require("./webpack.app")({dist: "ccl"}, {mode: "development"}); 17 18 module.exports = function(config) { 19 config.set({ 20 // enable / disable watching file and executing tests whenever any file changes 21 autoWatch: false, 22 23 // base path that will be used to resolve all patterns (eg. files, exclude) 24 basePath: "", 25 26 // redirect `console.log`s in test code to Karma's stdout. 27 // This is the default behavior in Karma 2.0; so we can remove when we upgrade. 28 browserConsoleLogOptions: { 29 format: "%b %T: %m", 30 level: "log", 31 terminal: true, 32 }, 33 34 // start these browsers 35 // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 36 browsers: ["ChromeHeadless"], 37 38 // enable / disable colors in the output (reporters and logs) 39 colors: true, 40 41 // Concurrency level 42 // how many browser should be started simultaneous 43 concurrency: Infinity, 44 45 // list of files / patterns to load in the browser 46 files: [ 47 "src/polyfills.ts", 48 "tests-loader.js", 49 ], 50 51 // frameworks to use 52 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 53 frameworks: ["mocha", "chai", "sinon"], 54 55 // level of logging 56 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 57 logLevel: config.LOG_INFO, 58 59 // TODO(tamird): https://github.com/webpack-contrib/karma-webpack/issues/188. 60 mime: { 61 "text/x-typescript": ["ts", "tsx"], 62 }, 63 64 // web server port 65 port: 9876, 66 67 // preprocess matching files before serving them to the browser 68 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 69 preprocessors: { 70 "src/polyfills.ts": ["webpack"], 71 "tests-loader.js": ["webpack", "sourcemap"], 72 }, 73 74 // test results reporter to use 75 // possible values: "dots", "progress" 76 // available reporters: https://npmjs.org/browse/keyword/karma-reporter 77 reporters: ["mocha"], 78 79 // Continuous Integration mode 80 // if true, Karma captures browsers, runs the tests and exits 81 singleRun: true, 82 83 // https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md 84 webpack: { 85 devtool: "eval-cheap-source-map", 86 mode: "development", 87 module: webpackConfig.module, 88 resolve: webpackConfig.resolve, 89 }, 90 91 // "stats" needs to be copied to webpackMiddleware configuration in order 92 // to correctly configure console output 93 webpackMiddleware: { 94 noInfo: true, 95 stats: webpackConfig.stats, 96 }, 97 }); 98 };