karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
468 stars 116 forks source link

Runner will not include new file when autoWatch:true #183

Closed gCardinal closed 6 years ago

gCardinal commented 8 years ago

I went through the issues and README and didn't find anything mentioning this so I will assume it's a bug.

Right now I have this config for my grunt task:

module.exports = {
    watch: {
        configFile: 'karma.all.conf.js',
        autoWatch: true,
        reporters: ['mocha'],
        files: [
            { src: ['src/**/*.js'], served: false, included: false, watched: true },
            { src: ['src/**/*.jsx'], served: false, included: false, watched: true },
            { src: ['tests/Unit/**/*.spec.js'] },
            { src: ['tests/Integration/**/*.spec.js'] },
        ]
    }
};

If I run this and add a test file after, the new file will not be watched. If I get this right, it's because the way files are served is an array is built from the globs in the configuration file.

Is there any way we could have the watcher consider new files? Or is it already a feature and my config is wrong?

strokyl commented 8 years ago

I had a similar issue and my files config comported two patterns such as once was more specific than the other one such as my test file was matched by the two patterns. I removed the more specific pattern and now I do not have this problem any-more. But I also thing there is a bug, because even if my configurations was stupid, it should not cause problem. Also I had issue reloading only the file that was matched twice by my config other file were reloaded correctly.

Krinkle commented 6 years ago

The autoWatch feature is part of the core Karma software, not the grunt-karma wrapper. If you still experience this on a current version of karma, please report it at https://github.com/karma-runner/karma/issues. Thanks!