Skip to content

Commit

Permalink
Build system: improve build for development workflow
Browse files Browse the repository at this point in the history
This adds a "test-only" gulp task that runs only tests (without clean/lint) and makes the single-spec test environment consistent with the whole-suite case.
  • Loading branch information
dgirardi committed Nov 30, 2021
1 parent a5b0d64 commit 0d840ef
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null,
gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false)));

// public tasks (dependencies are needed for each task since they can be ran on their own)
gulp.task('test', gulp.series(clean, lint, test));
gulp.task('test-only', test);
gulp.task('test', gulp.series(clean, lint, 'test-only'));

gulp.task('test-coverage', gulp.series(clean, testCoverage));
gulp.task(viewCoverage);
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) {
var webpackConfig = newWebpackConfig(codeCoverage);
var plugins = newPluginsArray(browserstack);

var files = file ? ['test/helpers/prebidGlobal.js', file] : ['test/test_index.js'];
var files = file ? ['test/test_deps.js', file] : ['test/test_index.js'];
// This file opens the /debug.html tab automatically.
// It has no real value unless you're running --watch, and intend to do some debugging in the browser.
if (watchMode) {
Expand Down
1 change: 1 addition & 0 deletions test/helpers/prebidGlobal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
window.$$PREBID_GLOBAL$$ = (window.$$PREBID_GLOBAL$$ || {});
window.$$PREBID_GLOBAL$$.installedModules = (window.$$PREBID_GLOBAL$$.installedModules || []);
window.$$PREBID_GLOBAL$$.cmd = window.$$PREBID_GLOBAL$$.cmd || [];
window.$$PREBID_GLOBAL$$.que = window.$$PREBID_GLOBAL$$.que || [];
3 changes: 3 additions & 0 deletions test/test_deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require('test/helpers/prebidGlobal.js');
require('test/mocks/adloaderStub.js');
require('test/mocks/xhr.js');
4 changes: 1 addition & 3 deletions test/test_index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
require('test/helpers/prebidGlobal.js');
require('test/mocks/adloaderStub.js');
require('test/mocks/xhr.js');
require('./test_deps.js');

var testsContext = require.context('.', true, /_spec$/);
testsContext.keys().forEach(testsContext);
Expand Down

0 comments on commit 0d840ef

Please sign in to comment.