Add support for coverage

This commit is contained in:
Emanuele Zattin 2017-10-11 12:35:12 +02:00
parent 4bcef8baff
commit f709453d53
2 changed files with 12 additions and 4 deletions

11
Jenkinsfile vendored
View File

@ -64,7 +64,11 @@ stage('build') {
linux_node_debug: doDockerBuild('node Debug'),
linux_node_release: doDockerBuild('node Release'),
linux_test_runners: doDockerBuild('test-runners'),
macos_node_debug: doMacBuild('node Debug'),
macos_node_debug: doMacBuild('node Debug', true) {
withCredentials([string(credentialsId: 'codecov-token-js', variable: 'CODECOV_TOKEN')]) {
sh 'node_modules/.bin/codecov'
}
},
macos_node_release: doMacBuild('node Release'),
//macos_realmjs_debug: doMacBuild('realmjs Debug'),
//macos_realmjs_release: doMacBuild('realmjs Release'),
@ -172,7 +176,8 @@ def doAndroidBuild(target, postStep = null) {
}
}
def doDockerBuild(target, postStep = null) {
def doDockerBuild(target, coverage = false, postStep = null) {
def prefix = coverage?'node_modules/.bin/nyc ':''
return {
node('docker') {
deleteDir()
@ -182,7 +187,7 @@ def doDockerBuild(target, postStep = null) {
reportStatus(target, 'PENDING', 'Build has started')
docker.image('node:6').inside('-e HOME=/tmp') {
sh "scripts/test.sh ${target}"
sh "${prefix}scripts/test.sh ${target}"
if(postStep) {
postStep.call()
}

View File

@ -49,6 +49,7 @@
"set-version": "scripts/set-version.sh",
"lint": "eslint",
"test": "scripts/test.sh",
"test-cover": "npm install nyc && node_modules/.bin/nyc scripts/test.sh",
"install": "node-pre-gyp install --fallback-to-build",
"build-changes": "node-pre-gyp build --debug",
"rebuild-changes": "node-pre-gyp rebuild --debug && cd tests && npm install",
@ -103,7 +104,9 @@
"rimraf": "^2.6.1",
"semver": "^5.1.0",
"shelljs": "^0.7.7",
"shx": "^0.2.2"
"shx": "^0.2.2",
"nyc": "^11.2.1",
"codecov": "^2.2.0"
},
"rnpm": {
"ios": {