Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Karma using Gradle?

I have Jasmine unit tests that I would like to run and get Istanbul code coverage reports for. I can run a command line script to run Karma in Jenkins, but it would be nice to have everything execute using my build.gradle.

Is it possible to run Karma using Gradle? I've searched google, but I can't seem to find a solution.

Thanks

like image 976
Eric Avatar asked Apr 11 '14 20:04

Eric


2 Answers

I solved this by creating and running an executable task in the build.gradle file:

task karma(type:Exec) 
{
    commandLine 'karma', 'start', '--single-run true'
}
like image 153
Eric Avatar answered Oct 24 '22 09:10

Eric


Following up here for anyone searching this in 2016 or later:

There's now a Gradle Karma Plugin that is worth considering.

like image 5
Eric Wendelin Avatar answered Oct 24 '22 10:10

Eric Wendelin