Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to run tests in a specific file #1727

Merged
merged 4 commits into from Oct 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions gulpfile.js
Expand Up @@ -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 "<path-to-test-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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add this to the test-coverage task?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure


var browserOverride = helpers.parseBrowserArgs(argv).map(helpers.toCapitalCase);
if (browserOverride.length > 0) {
Expand All @@ -186,8 +187,9 @@ gulp.task('test', ['clean'], function (done) {
new KarmaServer(karmaConf, newKarmaCallback(done)).start();
});

// If --file "<path-to-test-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.
Expand Down
4 changes: 2 additions & 2 deletions karma.conf.maker.js
Expand Up @@ -92,12 +92,12 @@ 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 = [
'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.
Expand Down