1
- module . exports = function ( config ) {
1
+ module . exports = function ( config ) {
2
2
const options = {
3
+
3
4
// base path that will be used to resolve all patterns (eg. files, exclude)
4
- basePath : "" ,
5
+ basePath : '' ,
6
+
5
7
6
8
// frameworks to use
7
9
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
8
10
frameworks : [ "jasmine" ] ,
9
11
12
+
10
13
// list of files / patterns to load in the browser
11
- files : [ "app/tests/**/*.*" ] ,
14
+ files : [ 'app/tests/**/*.*' ] ,
15
+
12
16
13
17
// list of files to exclude
14
- exclude : [ ] ,
18
+ exclude : [
19
+ ] ,
20
+
15
21
16
22
// preprocess matching files before serving them to the browser
17
23
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
18
- preprocessors : { } ,
24
+ preprocessors : {
25
+ } ,
26
+
19
27
20
28
// test results reporter to use
21
29
// possible values: 'dots', 'progress'
22
30
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
23
- reporters : [ "progress" ] ,
31
+ reporters : [ 'progress' ] ,
32
+
24
33
25
34
// web server port
26
35
port : 9876 ,
27
36
37
+
28
38
// enable / disable colors in the output (reporters and logs)
29
39
colors : true ,
30
40
41
+
31
42
// level of logging
32
43
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
33
44
logLevel : config . LOG_INFO ,
34
45
46
+
35
47
// enable / disable watching file and executing tests whenever any file changes
36
48
autoWatch : true ,
37
49
50
+
38
51
// start these browsers
39
52
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
40
53
browsers : [ ] ,
41
54
42
55
customLaunchers : {
43
56
android : {
44
- base : "NS" ,
45
- platform : " android"
57
+ base : 'NS' ,
58
+ platform : ' android'
46
59
} ,
47
60
ios : {
48
- base : "NS" ,
49
- platform : " ios"
61
+ base : 'NS' ,
62
+ platform : ' ios'
50
63
} ,
51
64
ios_simulator : {
52
- base : "NS" ,
53
- platform : " ios" ,
54
- arguments : [ " --emulator" ]
65
+ base : 'NS' ,
66
+ platform : ' ios' ,
67
+ arguments : [ ' --emulator' ]
55
68
}
56
69
} ,
57
70
@@ -64,7 +77,7 @@ module.exports = function(config) {
64
77
setWebpack ( config , options ) ;
65
78
66
79
config . set ( options ) ;
67
- } ;
80
+ }
68
81
69
82
function setWebpackPreprocessor ( config , options ) {
70
83
if ( config && config . bundle ) {
@@ -76,7 +89,7 @@ function setWebpackPreprocessor(config, options) {
76
89
if ( ! options . preprocessors [ file ] ) {
77
90
options . preprocessors [ file ] = [ ] ;
78
91
}
79
- options . preprocessors [ file ] . push ( " webpack" ) ;
92
+ options . preprocessors [ file ] . push ( ' webpack' ) ;
80
93
} ) ;
81
94
}
82
95
}
@@ -86,15 +99,11 @@ function setWebpack(config, options) {
86
99
const env = { } ;
87
100
env [ config . platform ] = true ;
88
101
env . sourceMap = config . debugBrk ;
89
- options . webpack = require ( "./webpack.config" ) ( env ) ;
102
+ env . appPath = config . appPath ;
103
+ options . webpack = require ( './webpack.config' ) ( env ) ;
90
104
delete options . webpack . entry ;
91
105
delete options . webpack . output . libraryTarget ;
92
- const invalidPluginsForUnitTesting = [
93
- "GenerateBundleStarterPlugin" ,
94
- "GenerateNativeScriptEntryPointsPlugin"
95
- ] ;
96
- options . webpack . plugins = options . webpack . plugins . filter (
97
- p => ! invalidPluginsForUnitTesting . includes ( p . constructor . name )
98
- ) ;
106
+ const invalidPluginsForUnitTesting = [ "GenerateBundleStarterPlugin" , "GenerateNativeScriptEntryPointsPlugin" ] ;
107
+ options . webpack . plugins = options . webpack . plugins . filter ( p => ! invalidPluginsForUnitTesting . includes ( p . constructor . name ) ) ;
99
108
}
100
109
}
0 commit comments