From 1bc09869b33f5ff80ea9bba10abac97efd210298 Mon Sep 17 00:00:00 2001 From: Oz Weiss Date: Thu, 19 Oct 2017 19:53:59 +0300 Subject: [PATCH 1/4] add option to run tests in a specific file --- gulpfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index f80cfe91d34..cfb61172401 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -173,10 +173,11 @@ gulp.task('webpack', ['clean'], function () { // By default, this runs in headless chrome. // // If --watch is given, the task will re-run unit tests whenever the source code changes +// If --file "" is given, the task will only run tests in the specified file. // If --browserstack is given, it will run the full suite of currently supported browsers. // If --browsers is given, browsers can be chosen explicitly. e.g. --browsers=chrome,firefox,ie9 gulp.task('test', ['clean'], function (done) { - var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch); + var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file); var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase); if (browserOverride.length > 0) { From ceab8f5e567f2c52d8104a2200b607d14ba8baf7 Mon Sep 17 00:00:00 2001 From: Oz Weiss Date: Thu, 19 Oct 2017 19:56:03 +0300 Subject: [PATCH 2/4] add option to run tests in a specific file --- karma.conf.maker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/karma.conf.maker.js b/karma.conf.maker.js index aad6a7d7c1d..2886d1e8dcc 100644 --- a/karma.conf.maker.js +++ b/karma.conf.maker.js @@ -92,10 +92,10 @@ function setBrowsers(karmaConf, browserstack) { } } -module.exports = function(codeCoverage, browserstack, watchMode) { +module.exports = function(codeCoverage, browserstack, watchMode, file) { var webpackConfig = newWebpackConfig(codeCoverage); var plugins = newPluginsArray(browserstack); - var files = [ + var files = file ? [file] : [ 'test/helpers/prebidGlobal.js', 'test/**/*_spec.js' ]; From 3005796fc59139e28fccee4dd212567e68ef2774 Mon Sep 17 00:00:00 2001 From: Oz Weiss Date: Tue, 24 Oct 2017 18:42:53 +0300 Subject: [PATCH 3/4] Update gulpfile.js --- gulpfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index cfb61172401..d7a151ce357 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -187,8 +187,9 @@ gulp.task('test', ['clean'], function (done) { new KarmaServer(karmaConf, newKarmaCallback(done)).start(); }); +// If --file "" is given, the task will only run tests in the specified file. gulp.task('test-coverage', ['clean'], function(done) { - new KarmaServer(karmaConfMaker(true, false), newKarmaCallback(done)).start(); + new KarmaServer(karmaConfMaker(true, false, argv.file), newKarmaCallback(done)).start(); }); // View the code coverage report in the browser. From b18e7a81ceb6e70990923cc49d6fe56904ec23c8 Mon Sep 17 00:00:00 2001 From: Oz Weiss Date: Tue, 24 Oct 2017 18:47:06 +0300 Subject: [PATCH 4/4] Update karma.conf.maker.js --- karma.conf.maker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/karma.conf.maker.js b/karma.conf.maker.js index 2886d1e8dcc..d2b1d49e081 100644 --- a/karma.conf.maker.js +++ b/karma.conf.maker.js @@ -95,9 +95,9 @@ function setBrowsers(karmaConf, browserstack) { module.exports = function(codeCoverage, browserstack, watchMode, file) { var webpackConfig = newWebpackConfig(codeCoverage); var plugins = newPluginsArray(browserstack); - var files = file ? [file] : [ + var files = [ 'test/helpers/prebidGlobal.js', - 'test/**/*_spec.js' + file ? file : 'test/**/*_spec.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.