1

This may be a two part question because my configuration may be a little messed up. I am trying to get a code coverage report for my protractor tests; grunt-protractor-coverage with istanbul no longer works with protractor version 3.3 so I am using gulp-istanbul with protractor-istanbul-plugin instead. I have instrumented the files I need but I cannot get protractor to use those instrumented files.

gulpfile.js:

var istanbul = require('gulp-istanbul');
var gulp = require('gulp');
var concat = require('gulp-concat');

gulp.task('concat', function(){
gulp.src('coverage/*.js')
// Instrument for protractor-istanbul-plugin:
    .pipe(istanbul({coverageVariable: '__coverage__'}))
    .pipe(concat('scripts.js'))
    .pipe(gulp.dest('test/e2e/testresults'))
    .pipe(istanbul.writeReports());
});

So first off, the example at Code coverage for Protractor tests in AngularJS helped me out with building the initial stuff, but I feel as though my gulp.src is incorrect. Right now the gulp.src points to where my coverage files are. Right now, my npm run command is "protractor": "gulp concat && protractor test/e2e/mockDataConf.js" in the package.json, and when I run this command the results of the tests are output before the tests even run. I am getting 0/0 100% across the board for everything in the report.

mockDataConf.js :

..//configuration stuff here...
var istanbulPlugin = require('protractor-istanbul-plugin');
plugins: [{
    inline: istanbulPlugin,
    logAssertions: true,
    failAssertions: true,
    outputPath: '../../test/e2e/testresults'
}]

So am I supposed to be directing the gulp.src to the directory with my instrumented files and why is the report output being shown before the tests run?

Edit: I now understand that this is just concat'ing the files I want to use and instrumenting them into a script.js file. I will update more once I get this all working.

Community
  • 1
  • 1
Jooba0352
  • 135
  • 1
  • 13
  • After two weeks of trying all the modules and plugins available for protractor coverage testing, I have come to the conclusion that protractor is not a suitable platform to do coverage testing. If it is possible, it's exceptionally difficult and the amount of work required may outweigh the benefits. – Jooba0352 Sep 07 '16 at 18:51
  • Do you have any output for this now? – Mithunkumar Jul 17 '20 at 05:23

0 Answers0