lazd / gulp-karma

Karma plugin for gulp
MIT License
75 stars 36 forks source link

Paths to exclude files #31

Closed dmaslov closed 9 years ago

dmaslov commented 10 years ago

Hi! From your Readme:

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.

I'm trying to pass paths for exclude files from tests(karma.config.js has exclude property). It doesn't work. Files are not excluded. If i keep exclude paths in karma.conf.js all works fine, but i want to keep all paths (files for testing and for excluding) in one place (gulpfile.js)

What the best practice to do that with gulp-karma plugin?

The part of my gulpfile.js below:

...
var paths = {
    tests: {
        frontend: [
            srcPath + '/js/**/*.js',
            testsPath + '/helpers.js',
            testsUnitPath + '/**/*.js'
         ],
        exclude: [
            srcPath + '/js/*.min.js',
            testsUnitPath + '/server.js'
        ]
    }
};

gulp.task('run-tests', function() {
    return gulp
            .src(paths.tests.frontend)
            .pipe(karma({
                configFile: testsPath + '/karma.config.js',
                action: 'run',
                exclude: paths.tests.exclude
            }))
            .on('error', function(err) {
                throw err;
            });
});
...
lazd commented 10 years ago

Please see https://github.com/karma-runner/karma/issues/1037, when it's closed, this plugin can be re-tooled or deprecated.

lazd commented 9 years ago

gulp-karma is deprecated (#43). Please use Karma directly: https://github.com/karma-runner/gulp-karma