jimivdw / grunt-mutation-testing

JavaScript Mutation Testing as grunt plugin. Tests your tests by mutating the code.
MIT License
51 stars 11 forks source link

Mutation testing using Karma test framework is taking very long #59

Open Sanuvimal123 opened 8 years ago

Sanuvimal123 commented 8 years ago

Hi @jimivdw

I have recently set up mutation testing in my JS framework. The thing is it dosent error out but it does not move from the below point.

Running "mutationTest:all" (mutationTest) task (08:46:43.934) INFO [KarmaServerManager]: Karma server started after 2647ms and is listening on port 12111

It just stays at this point.

I took al the config from the git example that you had provided.

    mutationTest: {
        options: {
            karma: {
                configFile: 'karma.conf.js'
            },
            reporters: {
                logLevel: 'INFO',
                html: {
                    dir: 'reports/mutation-test-html'
                },
                text: {
                    dir: 'reports/mutation-test-text'
                }
            }
        },
        all: {
            options: {
                code: ['src/**/*.js'],
                specs: 'test/**/*.js',
                mutate: ['src/**/*.js']
            }
        }
    }

If you could provide some advice it would be great.

Regards, Sanu

simondel commented 8 years ago

Hey @Sanuvimal123,

Are you using Jasmine? If so, could you try if stryker works for you? Right now it only supports Jasmine tests, but we plan on adding support for more frameworks in the future.

I had a chat with @jimivdw, @paysdoc and @nicojs tonight and we decided that we will (eventually) migrate everything to the stryker project.

svemir commented 8 years ago

My problem with both this and stryker is that our test setup is rather complex - we load many files and external libraries and we also run things like ngHtml2JsPreprocessor to pre-load angular templates etc.

It does not seem possible to replicate what we do in our karma.conf.js (and I would not want to maintain that in two places anyway.) Even if I specify our karma.conf.js as above, it still seems to expect me to list all the code under the "code" option. There is no simple way for me to do that with a few regular expressions.

Or maybe I am misunderstanding something?

nicojs commented 8 years ago

For Stryker we have an (undocumented) feature to load custom karma config. I'm also thinking of a way to automatically load the karma.conf.js. Of course there are settings that Stryker overrides, but it should work for stuff like preprocessing. Please open an issue in Stryker and we'll document the feature.