|
1 | 1 | /* karma.conf.js */
|
2 |
| -/** |
3 |
| - * @author: @AngularClass |
4 |
| - */ |
5 |
| -var path = require('path'); |
| 2 | +const path = require('path'); |
| 3 | +const testWebpackConfig = require('./webpack.test.js'); |
6 | 4 |
|
7 | 5 | module.exports = function(config) {
|
8 |
| - var testWebpackConfig = require('./webpack.test.js'); |
9 |
| - |
10 | 6 | var configuration = {
|
11 |
| - |
12 |
| - // base path that will be used to resolve all patterns (e.g. files, exclude) |
13 | 7 | basePath: '',
|
14 |
| - |
15 |
| - /* |
16 |
| - * Frameworks to use |
17 |
| - * |
18 |
| - * available frameworks: https://npmjs.org/browse/keyword/karma-adapter |
19 |
| - */ |
20 | 8 | frameworks: ['jasmine'],
|
21 |
| - |
22 |
| - // list of files to exclude |
23 | 9 | exclude: [ ],
|
| 10 | + client: { captureConsole: false }, |
| 11 | + files: [{pattern: './spec-bundle.js', watched: false}], |
| 12 | + preprocessors: { |
| 13 | + './spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] |
| 14 | + }, |
24 | 15 |
|
25 |
| - /* |
26 |
| - * list of files / patterns to load in the browser |
27 |
| - * |
28 |
| - * we are building the test environment in ./spec-bundle.js |
29 |
| - */ |
30 |
| - files: [ { pattern: './spec-bundle.js', watched: false } ], |
31 |
| - |
32 |
| - /* |
33 |
| - * preprocess matching files before serving them to the browser |
34 |
| - * available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor |
35 |
| - */ |
36 |
| - preprocessors: { './spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] }, |
37 |
| - |
38 |
| - // Webpack Config at ./webpack.test.js |
39 | 16 | webpack: testWebpackConfig,
|
40 | 17 |
|
41 | 18 | coverageReporter: {
|
42 |
| - dir : '../coverage/', |
43 |
| - reporters: [ |
44 |
| - { type: 'text-summary' }, |
45 |
| - { type: 'json' }, |
46 |
| - { type: 'html' } |
47 |
| - ] |
| 19 | + type: 'in-memory' |
48 | 20 | },
|
49 | 21 |
|
50 |
| - // Webpack please don't spam the console when running in karma! |
51 |
| - webpackServer: { noInfo: true }, |
| 22 | + remapCoverageReporter: { |
| 23 | + 'text-summary': null, |
| 24 | + json: './coverage/coverage.json', |
| 25 | + html: './coverage/html' |
| 26 | + }, |
52 | 27 |
|
53 |
| - /* |
54 |
| - * test results reporter to use |
55 |
| - * |
56 |
| - * possible values: 'dots', 'progress' |
57 |
| - * available reporters: https://npmjs.org/browse/keyword/karma-reporter |
58 |
| - */ |
59 |
| - reporters: [ 'mocha', 'coverage' ], |
| 28 | + webpackServer: { noInfo: true }, |
60 | 29 |
|
61 |
| - // web server port |
62 |
| - port: 9876, |
| 30 | + reporters: ['mocha', 'coverage', 'remap-coverage'], |
63 | 31 |
|
64 |
| - // enable / disable colors in the output (reporters and logs) |
65 | 32 | colors: true,
|
66 | 33 |
|
67 |
| - /* |
68 |
| - * level of logging |
69 |
| - * possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
70 |
| - */ |
71 |
| - logLevel: config.LOG_INFO, |
72 |
| - |
73 |
| - // do not fail on empty test suite |
74 |
| - //failOnEmptyTestSuite: false, |
| 34 | + logLevel: config.LOG_WARN, |
75 | 35 |
|
76 |
| - // enable / disable watching file and executing tests whenever any file changes |
77 | 36 | autoWatch: false,
|
78 | 37 |
|
79 |
| - /* |
80 |
| - * start these browsers |
81 |
| - * available browser launchers: https://npmjs.org/browse/keyword/karma-launcher |
82 |
| - */ |
83 | 38 | browsers: [
|
84 |
| - 'Chromium' |
| 39 | + 'Chrome' |
85 | 40 | ],
|
86 | 41 |
|
87 | 42 | customLaunchers: {
|
88 | 43 | Chrome_travis_ci: {
|
89 |
| - base: 'Chromium', |
90 |
| - chromeDataDir: path.resolve(__dirname, '.chrome'), |
| 44 | + base: 'Chrome', |
91 | 45 | flags: ['--no-sandbox']
|
92 | 46 | }
|
93 | 47 | },
|
94 | 48 |
|
95 |
| - /* |
96 |
| - * Continuous Integration mode |
97 |
| - * if true, Karma captures browsers, runs the tests and exits |
98 |
| - */ |
99 | 49 | singleRun: true
|
100 | 50 | };
|
101 | 51 |
|
102 | 52 | if(process.env.TRAVIS){
|
103 |
| - configuration.browsers = ['Chrome_travis_ci']; |
| 53 | + configuration.browsers = ['ChromeTravisCi']; |
104 | 54 | }
|
105 | 55 |
|
106 | 56 | config.set(configuration);
|
|
0 commit comments