How can I fail the build based on JUnit XML files generated by Jasmine?

I use Jasmine for JavaScript testing. Jasmine can generate JUnit XML files. How can I get Gradle to read these files and react accordingly (fail the build on failures)?


You’ll have to parse the JUnit XML files and throw and exception if you find failures.

Gradle doesn’t have code to parse these files, as it is the thing that generates them usually.