From 6bc92c524fa4412d573a1ad23d37780012ea1d9c Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 13 Jun 2024 10:50:52 -0700 Subject: [PATCH 1/4] Build system: increase heap size for test-coverage --- gulpfile.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 86c1b7fe509..5e824b77985 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -413,7 +413,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)); @@ -426,7 +428,15 @@ function runKarma(options, done) { // If --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 From 6fa376685aaa0f63ca5e3f3611842f5ef5095c0f Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 13 Jun 2024 11:00:45 -0700 Subject: [PATCH 2/4] fix duplication --- gulpfile.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 5e824b77985..a32a2d11ce6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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); @@ -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()); } @@ -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')); } } From 85861becedfbf239e0a72ab329c541895e49f0ef Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 13 Jun 2024 11:18:28 -0700 Subject: [PATCH 3/4] check out PR for duplicate checker --- .github/workflows/jscpd.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jscpd.yml b/.github/workflows/jscpd.yml index 281a4e5e8ec..b1e2ff03675 100644 --- a/.github/workflows/jscpd.yml +++ b/.github/workflows/jscpd.yml @@ -1,6 +1,6 @@ name: Check for Duplicated Code -on: +on: pull_request_target: branches: - master @@ -24,6 +24,10 @@ jobs: run: | npm install -g jscpd diff-so-fancy + - name: Check out PR + run: | + git checkout ${{ github.event.pull_request.head.sha }} + - name: Create jscpd config file run: | echo '{ From eba6a4f2846fabe7c7526c6ce864c7663180b49d Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 13 Jun 2024 11:32:22 -0700 Subject: [PATCH 4/4] undo jscpd changes --- .github/workflows/jscpd.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/jscpd.yml b/.github/workflows/jscpd.yml index b1e2ff03675..281a4e5e8ec 100644 --- a/.github/workflows/jscpd.yml +++ b/.github/workflows/jscpd.yml @@ -1,6 +1,6 @@ name: Check for Duplicated Code -on: +on: pull_request_target: branches: - master @@ -24,10 +24,6 @@ jobs: run: | npm install -g jscpd diff-so-fancy - - name: Check out PR - run: | - git checkout ${{ github.event.pull_request.head.sha }} - - name: Create jscpd config file run: | echo '{