1 | import webpackTestConfig from './webpack-test.config';
|
2 | import { ConfigOptions } from 'karma';
|
3 |
|
4 | export default (config) => {
|
5 | config.set({
|
6 | // Base path that will be used to resolve all patterns (eg. files, exclude).
|
7 | basePath: './',
|
8 |
|
9 | // Frameworks to use.
|
10 | // Available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
11 | frameworks: ['jasmine'],
|
12 |
|
13 | // List of files to load in the browser.
|
14 | files: [
|
15 | 'karma-test-entry.ts'
|
16 | ],
|
17 |
|
18 | // Preprocess matching files before serving them to the browser.
|
19 | // Available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
20 | preprocessors: {
|
21 | 'karma-test-entry.ts': ['webpack', 'sourcemap']
|
22 | },
|
23 |
|
24 | webpack: webpackTestConfig,
|
25 |
|
26 | // Webpack please don't spam the console when running in karma!
|
27 | webpackMiddleware: {
|
28 | noInfo: true,
|
29 | // Use stats to turn off verbose output.
|
30 | stats: {
|
31 | chunks: false
|
32 | }
|
33 | },
|
34 |
|
35 | mime: {
|
36 | 'text/x-typescript': [ 'ts' ]
|
37 | },
|
38 |
|
39 | coverageIstanbulReporter: {
|
40 | reports: ['text-summary', 'html', 'lcovonly'],
|
41 | fixWebpackSourcePaths: true
|
42 | },
|
43 |
|
44 | // Test results reporter to use.
|
45 | // Possible values: 'dots', 'progress'.
|
46 | // Available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
47 | reporters: ['mocha', 'coverage-istanbul'],
|
48 |
|
49 | // Level of logging
|
50 | // Possible values:
|
51 | // - config.LOG_DISABLE
|
52 | // - config.LOG_ERROR
|
53 | // - config.LOG_WARN
|
54 | // - config.LOG_INFO
|
55 | // - config.LOG_DEBUG
|
56 | logLevel: config.LOG_WARN,
|
57 |
|
58 | // Start these browsers.
|
59 | // Available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
60 | browsers: ['Chrome'],
|
61 |
|
62 | browserConsoleLogOptions: {
|
63 | terminal: true,
|
64 | level: 'log'
|
65 | },
|
66 |
|
67 | singleRun: true,
|
68 | colors: true
|
69 | } as ConfigOptions);
|
70 | };
|