File tree 2 files changed +32
-2
lines changed
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,8 @@ export class TestExecutionService implements ITestExecutionService {
208
208
}
209
209
210
210
karmaConfig . projectDir = projectData . projectDir ;
211
+ karmaConfig . bundle = this . $options . bundle ;
212
+ karmaConfig . platform = platform . toLowerCase ( ) ;
211
213
this . $logger . debug ( JSON . stringify ( karmaConfig , null , 4 ) ) ;
212
214
213
215
return karmaConfig ;
Original file line number Diff line number Diff line change 1
1
module . exports = function ( config ) {
2
- config . set ( {
2
+ const options = {
3
3
4
4
// base path that will be used to resolve all patterns (eg. files, exclude)
5
5
basePath : '' ,
@@ -73,5 +73,33 @@ module.exports = function(config) {
73
73
// Continuous Integration mode
74
74
// if true, Karma captures browsers, runs the tests and exits
75
75
singleRun : false
76
- } )
76
+ } ;
77
+
78
+ setWebpackPreprocessor ( config , options ) ;
79
+ setWebpack ( config , options ) ;
80
+
81
+ config . set ( options ) ;
82
+ }
83
+
84
+ function setWebpackPreprocessor ( config , options ) {
85
+ if ( config && config . bundle ) {
86
+ if ( ! options . preprocessors ) {
87
+ options . preprocessors = { } ;
88
+ }
89
+
90
+ options . files . forEach ( file => {
91
+ if ( ! options . preprocessors [ file ] ) {
92
+ options . preprocessors [ file ] = [ ] ;
93
+ }
94
+ options . preprocessors [ file ] . push ( 'webpack' ) ;
95
+ } ) ;
96
+ }
97
+ }
98
+
99
+ function setWebpack ( config , options ) {
100
+ if ( config && config . bundle ) {
101
+ const env = { } ;
102
+ env [ config . platform ] = true ;
103
+ options . webpack = require ( './webpack.config' ) ( env ) ;
104
+ }
77
105
}
You can’t perform that action at this time.
0 commit comments