Skip to content

Commit

Permalink
Build system: increase heap size for test-coverage (#11792)
Browse files Browse the repository at this point in the history
* Build system: increase heap size for test-coverage

* fix duplication

* check out PR for duplicate checker

* undo jscpd changes
  • Loading branch information
dgirardi committed Jun 13, 2024
1 parent 5126673 commit 19131b9
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ function makeVerbose(config = webpackConfig) {
});
}

function prebidSource(webpackCfg) {
var externalModules = helpers.getArgModules();

const analyticsSources = helpers.getAnalyticsSources();
const moduleSources = helpers.getModulePaths(externalModules);

return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(webpackCfg, webpack));
}

function makeDevpackPkg(config = webpackConfig) {
return function() {
var cloned = _.cloneDeep(config);
Expand All @@ -163,14 +174,7 @@ function makeDevpackPkg(config = webpackConfig) {
.filter((use) => use.loader === 'babel-loader')
.forEach((use) => use.options = Object.assign({}, use.options, babelConfig));

var externalModules = helpers.getArgModules();

const analyticsSources = helpers.getAnalyticsSources();
const moduleSources = helpers.getModulePaths(externalModules);

return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(cloned, webpack))
return prebidSource(cloned)
.pipe(gulp.dest('build/dev'))
.pipe(connect.reload());
}
Expand All @@ -183,14 +187,7 @@ function makeWebpackPkg(config = webpackConfig) {
}

return function buildBundle() {
var externalModules = helpers.getArgModules();

const analyticsSources = helpers.getAnalyticsSources();
const moduleSources = helpers.getModulePaths(externalModules);

return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(cloned, webpack))
return prebidSource(cloned)
.pipe(gulp.dest('build/dist'));
}
}
Expand Down Expand Up @@ -413,7 +410,9 @@ function runKarma(options, done) {
// the karma server appears to leak memory; starting it multiple times in a row will run out of heap
// here we run it in a separate process to bypass the problem
options = Object.assign({browsers: helpers.parseBrowserArgs(argv)}, options)
const child = fork('./karmaRunner.js');
const child = fork('./karmaRunner.js', null, {
env: Object.assign({}, options.env, process.env)
});
child.on('exit', (exitCode) => {
if (exitCode) {
done(new Error('Karma tests failed with exit code ' + exitCode));
Expand All @@ -426,7 +425,15 @@ function runKarma(options, done) {

// If --file "<path-to-test-file>" is given, the task will only run tests in the specified file.
function testCoverage(done) {
runKarma({coverage: true, browserstack: false, watch: false, file: argv.file}, done);
runKarma({
coverage: true,
browserstack: false,
watch: false,
file: argv.file,
env: {
NODE_OPTIONS: '--max-old-space-size=8096'
}
}, done);
}

function coveralls() { // 2nd arg is a dependency: 'test' must be finished
Expand Down

0 comments on commit 19131b9

Please sign in to comment.