Skip to content

Commit

Permalink
Build system: fix "test-coverage" (prebid#8819)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi authored Aug 15, 2022
1 parent 9eda78a commit 902cfc0
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 133 deletions.
14 changes: 10 additions & 4 deletions babelConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ module.exports = function (options = {}) {
}
]
],
'plugins': [
[path.resolve(__dirname, './plugins/pbjsGlobals.js'), options],
[useLocal('@babel/plugin-transform-runtime')],
],
'plugins': (() => {
const plugins = [
[path.resolve(__dirname, './plugins/pbjsGlobals.js'), options],
[useLocal('@babel/plugin-transform-runtime')],
];
if (options.codeCoverage) {
plugins.push([useLocal('babel-plugin-istanbul')])
}
return plugins;
})(),
}
}
13 changes: 1 addition & 12 deletions karma.conf.maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,9 @@ function newWebpackConfig(codeCoverage, disableFeatures) {
.flatMap((r) => r.use)
.filter((use) => use.loader === 'babel-loader')
.forEach((use) => {
use.options = babelConfig({test: true, disableFeatures});
use.options = babelConfig({test: true, codeCoverage, disableFeatures});
});

if (codeCoverage) {
webpackConfig.module.rules.push({
enforce: 'post',
exclude: /(node_modules)|(test)|(integrationExamples)|(build)|polyfill.js|(src\/adapters\/analytics\/ga.js)/,
use: {
loader: '@jsdevtools/coverage-istanbul-loader',
options: { esModules: true }
},
test: /\.js$/
})
}
return webpackConfig;
}

Expand Down
Loading

0 comments on commit 902cfc0

Please sign in to comment.