From 34f2752b4a8b8c29db8c05e9d9d5e79d7c978b51 Mon Sep 17 00:00:00 2001 From: Daniel Luxemburg Date: Sun, 23 Feb 2014 20:18:00 -0500 Subject: [PATCH] give option to not override files --- README.md | 11 ++++++++++- index.js | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e455bd..109972d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Type: `String` The path to the Karma configuration file. #### options.action -Type: `String` +Type: `String` Default: `run` One of the following: @@ -57,6 +57,15 @@ One of the following: * **`run`**: Start the server, run tests once, then exit. * **`watch`**: Start the server, run tests once, then watch for changes and run when files change. +#### options.noOverrideFiles +Type: `Boolean` +Default: `false` + +One of the following: + + * **`true`**: Use paths supplied from `gulp.src()` as the `files` option for Karma. + * **`false`**: Don't do that (helpful when using the `{included: false}` option, such as running with RequireJS). + #### options.* Any Karma option can be passed as part of the options object. See [Karma Configuration] for a complete list of options. **Note:** It's best practice to put options in your Karma config file. diff --git a/index.js b/index.js index e7c60ae..1ed80ec 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ var server = require('karma').server; var karmaPlugin = function(options) { var child; var stream; + var overrideFiles = !options.noOverrideFiles; var files = []; options = extend({ @@ -24,6 +25,7 @@ var karmaPlugin = function(options) { // Remove option in case Karma uses it in the future delete options.action; + delete options.noOverrideFiles; if (action === 'watch') { // Never set singleRun in background mode @@ -91,7 +93,7 @@ var karmaPlugin = function(options) { function endStream() { // Override files if they were piped // This doesn't work with the runner, but works fine with singleRun and autoWatch - if (files.length) { + if (files.length && overrideFiles) { options.files = files; }