Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Istanbul (Node) Coverage Reporting #3

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
/.gradle/
/.repo/
/build/
/samples/istanbul/node_modules/
*.iml
gradle.properties
9 changes: 9 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
image: java:latest

stages:
- test

test:
stage: test
script:
- "./gradlew clean test check"
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

93 changes: 89 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# gradle-console-reporter

[![Build Status](https://img.shields.io/travis/ksoichiro/gradle-console-reporter/master.svg?style=flat-square)](https://travis-ci.org/ksoichiro/gradle-console-reporter)
[![Build status](https://img.shields.io/appveyor/ci/ksoichiro/gradle-console-reporter/master.svg?style=flat-square)](https://ci.appveyor.com/project/ksoichiro/gradle-console-reporter)
[![Coverage Stagus](https://img.shields.io/coveralls/ksoichiro/gradle-console-reporter/master.svg?style=flat-square)](https://coveralls.io/github/ksoichiro/gradle-console-reporter?branch=master)
[![build status](https://gitlab.com/bti360/gradle-console-reporter/badges/master/build.svg)](https://gitlab.com/bti360/gradle-console-reporter/commits/master)
[![coverage report](https://gitlab.com/bti360/gradle-console-reporter/badges/master/coverage.svg)](https://gitlab.com/bti360/gradle-console-reporter/commits/master)

> Gradle plugin to report various kinds of summaries to console.

This plugin will aggregate test reports and show them to console.
It's useful when you use CI services that don't save artifacts.

<img src="samples/images/demo1.png" width="400">
![demo-image](samples/images/demo1.png)

## Available reports

* Total coverage report
* JUnit test report
* JaCoCo coverage report
* Cobertura coverage report
* Istanbul (Node) coverage report

## Usage

Expand Down Expand Up @@ -172,6 +173,10 @@ cobertura: 71.4%

## Tasks

### reportTotal

Print the aggregated test report.

### reportTest

Print JUnit test report.
Expand All @@ -187,10 +192,20 @@ This task will be executed automatically after `jacocoTestReport` task by defaul
Print Cobertura coverage report.
This task will be executed automatically after `cobertura` task by default, so you don't need to call it.

### reportIstanbul

Print Istanbul coverage report.

## Configurations

```gradle
consoleReporter {
total {
// Set this property to true if you want an aggregated report.
// Default is false.
enabled false
}

junit {
// Set this property to false if you don't need JUnit report.
// Default is true.
Expand Down Expand Up @@ -362,11 +377,81 @@ consoleReporter {
// Default is true.
colorEnabled true
}

istanbul {
// Set this property to true if you need Istanbul report.
// Default is true.
enabled true

// Set this property to true if you want to see console report only when coverage is executed.
// Default is false.
onlyWhenCoverageTaskExecuted false

// Set this property to false if you want to see console report
// just after each project's istanbul task.
// If set to true, all reports will be shown at the end of builds.
// Default is true.
reportAfterBuildFinished true

// Set this property to true if you want to treat a lack of the minimum coverage as an build error.
// This property sees thresholdError property, and if the coverage has fallen below this value
// the plugin will throw an exception to cause a build error.
// Default is false.
// If you set this to true, you should also set thresholdError property.
failIfLessThanThresholdError false

// Set this property to false if you don't like this plugin automatically changing some
// property of cobertura plugin.
// If this is set to true, the plugin will set some properties of cobertura plugin
// to calculate coverage.
// Default is true.
autoconfigureCoverageConfig true

// Set this property to your custom istanbul task name, if you need.
// Default is 'generateIstanbulReport'.
coverageTaskName 'generateCoberturaReport'

// Set this property to your Istanbul report JSON file.
// Default is null, which means
// ${project.projectDir}/coverage/coverage-summary.json
// will be parsed.
reportFile

// Set this property to a certain C0 coverage percentage.
// When the coverage is greater than or equals to this value,
// the coverage will be shown with green color.
// Default is 90.
thresholdFine 90

// Set this property to a certain C0 coverage percentage.
// When the coverage is greater than or equals to this value,
// the coverage will be shown with yellow color.
// (When the coverage is less than this value, result will be red.)
// Default is 70.
thresholdWarning 70

// Set this property to a certain C0 coverage percentage.
// When the coverage is less than this value and
// failIfLessThanThresholdError property is set to true,
// the build will fail.
// Default is 0.
thresholdError 0

// Set this property if you want to customize build error message
// when you use 'failIfLessThanThresholdError' feature.
brokenCoverageErrorMessage "Coverage has fallen below the threshold in some projects."

// Set this property to false if you don't need colorized output.
// Default is true.
colorEnabled true
}
}
```

## License

Copyright 2017 BTI360

Copyright 2015 Soichiro Kashima

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
14 changes: 0 additions & 14 deletions appveyor.yml

This file was deleted.

8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.gradle.publish:plugin-publish-plugin:0.9.2'
classpath 'com.gradle.publish:plugin-publish-plugin:0.9.7'
}
}

Expand All @@ -15,10 +15,13 @@ plugins {
id 'maven-publish'
id 'net.saliman.cobertura' version '2.3.0'
id 'com.github.kt3k.coveralls' version '2.4.0'
// id 'com.github.ksoichiro.console.reporter' version '0.3.4'
id 'com.bti360.console.reporter' version '0.6.0'
}

repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}

Expand Down Expand Up @@ -51,6 +54,7 @@ dependencies {
exclude module: 'groovy-all'
}
testRuntime 'cglib:cglib-nodep:3.2.0'
testRuntime 'com.moowork.gradle:gradle-node-plugin:1.1.1'
testCompile 'net.saliman:gradle-cobertura-plugin:2.3.0'
}

Expand Down
27 changes: 13 additions & 14 deletions gradle/meta.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
ext {
meta = [:]
meta.versionName = '0.6.0-SNAPSHOT'
meta.group = 'com.github.ksoichiro'
meta.versionName = '0.6.4'
meta.group = 'com.bti360'
meta.pomArtifactId = 'gradle-console-reporter'
meta.javaCompatibility = 1.6
meta.gitHubUsername = 'ksoichiro'
meta.gitHubFullname = 'Soichiro Kashima'
meta.gitHubUrl = "https://github.com/${meta.gitHubUsername}/${meta.pomArtifactId}"
meta.gitlabGroup = "bti360"
meta.gitlabUrl = "https://gitlab.com/${meta.gitlabGroup}/gradle-console-reporter"
meta.pomName = meta.pomArtifactId
meta.pomInceptionYear = '2015'
meta.pomDescription = 'Gradle plugin to report various kinds of summaries to console.'
meta.pomUrl = meta.gitHubUrl
meta.pomScmUrl = meta.gitHubUrl
meta.pomScmConnection = "scm:git@github.com/${meta.gitHubUsername}/${meta.pomArtifactId}.git"
meta.pomScmDevConnection = "scm:git@github.com:${meta.gitHubUsername}/${meta.pomArtifactId}.git"
meta.pomUrl = meta.gitlabUrl
meta.pomScmUrl = meta.gitlabUrl
meta.pomScmConnection = "scm:git@gitlab.com/${meta.gitlabGroup}/${meta.pomArtifactId}.git"
meta.pomScmDevConnection = "scm:git@gitlab.com:${meta.gitlabGroup}/${meta.pomArtifactId}.git"
meta.pomLicenseName = 'Apache Licence 2.0'
meta.pomLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0'
meta.pomLicenseDist = 'repo'
meta.pomDeveloperId = meta.gitHubUsername
meta.pomDeveloperName = meta.gitHubFullname
meta.pomDeveloperUrl = "http://github.com/${meta.gitHubUsername}"
meta.pomDeveloperId = meta.gitlabGroup
meta.pomDeveloperName = meta.gitlabGroup
meta.pomDeveloperUrl = "http://bti360.com"
meta.localRepositoryUrl = uri('.repo')
meta.pluginVcsurl = "https://github.com/${meta.gitHubUsername}/${meta.pomArtifactId}.git"
meta.pluginVcsurl = "https://gitlab.com/${meta.gitlabGroup}/${meta.pomArtifactId}.git"
meta.pluginTags = ['testing', 'junit', 'reporting']
meta.gradlePluginId = 'com.github.ksoichiro.console.reporter'
meta.gradlePluginId = 'com.bti360.console.reporter'
meta.propNameOssrhUsername = 'ossrhUsername'
meta.propNameOssrhPassword = 'ossrhPassword'
}
3 changes: 3 additions & 0 deletions gradle/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ afterEvaluate { project ->
artifact javadocJar
}
}
repositories {
mavenLocal()
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
8 changes: 3 additions & 5 deletions samples/cobertura/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
buildscript {
repositories {
mavenCentral()
maven {
url uri('../../.repo')
}
mavenLocal()
}
dependencies {
classpath 'com.github.ksoichiro:gradle-console-reporter:+'
classpath 'gradle.plugin.com.bti360:gradle-console-reporter:+'
}
}

plugins {
id 'net.saliman.cobertura' version '2.3.0'
}

apply plugin: 'com.github.ksoichiro.console.reporter'
apply plugin: 'com.bti360.console.reporter'
apply plugin: 'java'

repositories {
Expand Down
5 changes: 5 additions & 0 deletions samples/istanbul/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.idea/
/.gradle/
/build/
*.iml
gradle.properties
23 changes: 23 additions & 0 deletions samples/istanbul/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
url uri('https://plugins.gradle.org/m2/')
}
}
dependencies {
classpath 'com.bti360:gradle-console-reporter:+'
classpath 'com.moowork.gradle:gradle-node-plugin:+'
}
}

apply plugin: 'com.bti360.console.reporter'
apply plugin: 'com.moowork.node'

consoleReporter {
istanbul {
thresholdFine 50
reportFile = new File("${project.buildDir}/coverage/report-json/coverage-summary.json")
}
}
Binary file not shown.
6 changes: 6 additions & 0 deletions samples/istanbul/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Dec 22 20:58:34 JST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Loading