@@ -102,6 +102,10 @@ function setupUnitTestBuild(config, env, webpack) {
102
102
config . module . rule ( 'css' ) . include . add ( runnerPath ) ;
103
103
config . module . rule ( 'xml' ) . include . add ( runnerPath ) ;
104
104
config . module . rule ( 'js' ) . include . add ( runnerPath ) ;
105
+ if ( ! env . testTsConfig && env . testTSConfig ) {
106
+ webpack . Utils . log . warn ( 'Mapping env.testTSConfig to env.testTsConfig' ) ;
107
+ }
108
+ env . testTsConfig = env . testTsConfig || env . testTSConfig ;
105
109
const defaultTsConfig = webpack . Utils . project . getProjectFilePath ( 'tsconfig.spec.json' ) ;
106
110
const testTsEntryPath = join ( webpack . Utils . platform . getEntryDirPath ( ) , 'test.ts' ) ;
107
111
const testJsEntryPath = join ( webpack . Utils . platform . getEntryDirPath ( ) , 'test.js' ) ;
@@ -122,6 +126,25 @@ function setupUnitTestBuild(config, env, webpack) {
122
126
return args ;
123
127
} ) ;
124
128
129
+ if ( env . codeCoverage ) {
130
+ config . module
131
+ . rule ( 'istanbul-loader' )
132
+ . enforce ( 'post' )
133
+ . include
134
+ . add ( webpack . Utils . platform . getEntryDirPath ( ) )
135
+ . end ( )
136
+ . exclude
137
+ . add ( / \. s p e c \. ( t s x ? | j s x ? ) $ / )
138
+ . add ( join ( webpack . Utils . platform . getEntryDirPath ( ) , 'tests' ) )
139
+ . add ( join ( webpack . Utils . platform . getEntryDirPath ( ) , 'test.ts' ) )
140
+ . add ( join ( webpack . Utils . platform . getEntryDirPath ( ) , 'test.js' ) )
141
+ . end ( )
142
+ . test ( / \. ( t s x ? | j s x ? ) / )
143
+ . use ( '@jsdevtools/coverage-istanbul-loader' )
144
+ . loader ( require . resolve ( '@jsdevtools/coverage-istanbul-loader' ) )
145
+ . options ( { esModules : true } ) ;
146
+ }
147
+
125
148
// config.entryPoints.clear()
126
149
config . entry ( 'bundle' )
127
150
. clear ( )
0 commit comments