I'd like Protractor E2E tests to reflect my code coverage in SonarQube.
I've tried grunt-protractor-coverage npm module but it shows 100% coverage while the report file it creates is empty.
Here's the relevant part of my Gruntfile.js:
connect: {
options: {
port: 9000,
hostname: 'localhost'
},
runtime: {
options: {
base: 'instrumented/build'
}
}
},
instrument: {
files: 'build/**/*.js',
options: {
lazy: true,
basePath: "instrumented"
}
},
protractor_coverage: {
options: {
keepAlive: true,
noColor: false,
coverageDir: 'coverage',
args: {
baseUrl: 'http://localhost:9000'
}
},
local: {
options: {
configFile: './protractor-chrome-conf.js'
}
}
},
makeReport: {
src: 'coverage/*.json',
options: {
type: 'lcov',
dir: 'coverage/dir',
print: 'detail'
}
}
Any ideas?
You must first install the SonarJS code analyzer
And then this plugin can be fed with a LCOV report providing the coverage information: http://docs.sonarqube.org/display/PLUG/JavaScript+Coverage+Results+Import