1
- // Karma configuration
2
- // Generated on Mon Apr 17 2017 20:18:26 GMT+0700 (Новосибирское стандартное время)
3
-
4
- module . exports = function ( config ) {
1
+ var webpack = require ( 'webpack' ) ;
2
+ var path = require ( 'path' ) ;
3
+ module . exports = function ( config ) {
5
4
config . set ( {
6
-
7
- // base path that will be used to resolve all patterns (eg. files, exclude)
8
- basePath : '' ,
9
-
10
-
11
- // frameworks to use
12
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13
- frameworks : [ 'jasmine' , "karma-typescript" ] ,
14
-
15
-
16
- // list of files / patterns to load in the browser
5
+ browsers : [ 'Chrome' ] ,
6
+ colors : true ,
7
+ coverageReporter : {
8
+ dir : './' ,
9
+ reporters : [
10
+ { type : 'lcov' , subdir : 'coverage' }
11
+ ]
12
+ } ,
13
+ customLaunchers : {
14
+ Chrome_travis_ci : {
15
+ base : 'Chrome' ,
16
+ flags : [ '--no-sandbox' ]
17
+ }
18
+ } ,
17
19
files : [
18
- 'node_modules/es6-shim/es6-shim.min.js' ,
19
- 'karma.entry.js' ,
20
- { pattern : "src/**/*.ts" } ,
21
- { pattern : "tests/**/*.ts" }
20
+ 'karma.entry.js'
22
21
] ,
23
-
24
- // list of files to exclude
25
- exclude : [
26
-
27
- ] ,
28
-
29
-
30
- // preprocess matching files before serving them to the browser
31
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
22
+ frameworks : [ 'jasmine' ] ,
32
23
preprocessors : {
33
24
'karma.entry.js' : [ 'webpack' , 'sourcemap' ] ,
34
- "src/**/*.ts" : [ "karma-typescript" , "coverage" ] ,
35
- "tests/**/*.ts" : [ "karma-typescript" ]
25
+ 'src/**/*.js' : [ 'coverage' ]
36
26
} ,
37
-
38
-
39
- // test results reporter to use
40
- // possible values: 'dots', 'progress'
41
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
42
- reporters : [ "progress" , "karma-typescript" ] ,
43
-
44
-
45
- // web server port
46
- port : 9876 ,
47
-
48
-
49
- // enable / disable colors in the output (reporters and logs)
50
- colors : true ,
51
-
52
-
53
- // level of logging
54
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
55
- logLevel : config . LOG_INFO ,
56
-
57
-
58
- // enable / disable watching file and executing tests whenever any file changes
59
- autoWatch : true ,
60
-
61
-
62
- // start these browsers
63
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
64
- browsers : [ 'Chrome' ] , // 'Firefox', 'Opera', 'IE'],
65
-
66
-
67
- // Continuous Integration mode
68
- // if true, Karma captures browsers, runs the tests and exits
69
- singleRun : false ,
70
-
71
- // Concurrency level
72
- // how many browser should be started simultaneous
73
- concurrency : Infinity
74
- } )
75
- }
27
+ reporters : [ 'spec' , 'coverage' ] ,
28
+ singleRun : true ,
29
+ webpack : {
30
+ devtool : 'inline-source-map' ,
31
+ module : {
32
+ rules : [
33
+ {
34
+ exclude : [ path . resolve ( __dirname , 'node_modules' ) ] ,
35
+ include : [
36
+ path . resolve ( __dirname , 'src' ) ,
37
+ path . resolve ( __dirname , 'tests' )
38
+ ] ,
39
+ loader : 'ts-loader' ,
40
+ test : / .* (? ! \. d \. t s ) | ( \. t s ) $ / ,
41
+ options : {
42
+ compilerOptions : {
43
+ noEmitHelpers : true
44
+ }
45
+ }
46
+ } ,
47
+ {
48
+ exclude : [
49
+ path . resolve ( __dirname , 'node_modules/@angular' ) ,
50
+ path . resolve ( __dirname , 'node_modules/rxjs' )
51
+ ] ,
52
+ include : [
53
+ path . resolve ( __dirname , 'src' )
54
+ ] ,
55
+ loader : 'istanbul-instrumenter-loader' ,
56
+ test : / \. t s $ / ,
57
+ enforce : 'post'
58
+ }
59
+ ]
60
+ } ,
61
+ resolve : {
62
+ extensions : [ '.ts' , '.tsx' , '.json' , '.js' ] ,
63
+ modules : [
64
+ 'node_modules'
65
+ ]
66
+ }
67
+ } ,
68
+ webpackServer : {
69
+ noInfo : true ,
70
+ noLog : true
71
+ }
72
+ } ) ;
73
+ if ( process . env . TRAVIS ) {
74
+ config . browsers = [ 'Chrome_travis_ci' ] ;
75
+ }
76
+ } ;
0 commit comments