dimanche 4 octobre 2015

Gradle Task failing because JSHint detect improvement on code

I have a task that will run the Javascript test, and I'm trying to put JSHint to verify the code after run the tests, right?

So, this is a part of my build.gradle file:

apply plugin: 'com.eriwen.gradle.js'
def jsSrcDir = "src/main/resources/static/js/"
def jsSrcTestDir = "src/test/resources/"

javascript.source {
    dev {
        js {
            srcDir jsSrcDir
            include "*.js"

        }
    }
    test {
        js {
            srcDir jsSrcTestDir
            include "*.js"
        }
    }
}

task jasmineTest(dependsOn: ['npmTest'],type: Exec)

jasmineTest.doFirst {
    println "Running JSHint ----> SOURCE CODE"
    commandLine "jshint", jsSrcDir

    //println "Running JSHint ----> TEST CODE"
    //commandLine "jshint", "src/test/resources/"
}

So, ok, it's running well, but is always failing, because JSHint are finding some improvements on my code, it's cool, but it's not my intention, I want to run the jasmine Test task, and does not matter if JSHint found or not an improvement, my task only need to fail if the test fail.

So, what I need to configure on my build gradle to put this working well? Also, I have .jshintrc and .jshintignore configured.

Aucun commentaire:

Enregistrer un commentaire