<commit_before>var gulp = require('gulp'),
    paths = require('../paths.config.js'),
    karma = require('karma');

// run karma tests and coverage
gulp.task('unit', function () {
    new karma.Server({
        configFile: paths.karmaConf,
        singleRun: true,
        browsers: ['IE', 'Firefox', 'Chrome'],
        reporters: ['progress', 'coverage'],
        coverageReporter: {
            type: 'lcovonly',
            dir: paths.coverage
        },
        preprocessors: {
            // source files, that you wanna generate coverage for
            // do not include tests or libraries
            // (these files will be instrumented by Istanbul)
            'Presentation.Web/app/**/!(*.spec|*.po).js': ['coverage']
        },
        autoWatch: false
    }).start();
});

// open coverage results.
gulp.task('localCover', ['localUnit'], function () {
    var open = require('gulp-open');

    gulp.src(paths.coverage + '/Phantom*/index.html')
        .pipe(open({
            app: 'chrome'
        }));
});

// run karma tests and coverage locally
gulp.task('localUnit', function (done) {
    new karma.Server({
        configFile: paths.karmaConf,
        singleRun: true,
        reporters: ['progress', 'coverage'],
        coverageReporter: {
            type: 'html',
            dir: paths.coverage
        },
        preprocessors: {
            // source files, that you wanna generate coverage for
            // do not include tests or libraries
            // (these files will be instrumented by Istanbul)
            'Presentation.Web/app/**/!(*.spec|*.po).js': ['coverage']
        },
        autoWatch: false
    }, done).start();
});

// run e2e tests with protractor
gulp.task('e2e', function () {
    var protractor = require('gulp-protractor').protractor;
    var browserstack = require('gulp-browserstack');

    var taskExitValue = 0;

    return gulp.src(paths.e2eFiles)
        .pipe(browserstack.startTunnel({
            key: process.env.BROWSERSTACK_KEY
        }))
        .pipe(protractor({
            configFile: 'protractor.conf.js'
        }))
        .on('error', function () {
            taskExitValue = 1;
            this.emit('end');
        })
        .pipe(browserstack.stopTunnel())
        .once('end', function () {
            // fix error where gulp is hanging after finish
            process.exit(taskExitValue);
        });
});

// publish coverage to codecov
gulp.task('codecov', function() {
    var codecov = require('gulp-codecov.io');

    return gulp.src('./coverage/**/lcov.info')
        .pipe(codecov());
});<commit_msg>Use cobertura file format for coverage.<commit_after>var gulp = require('gulp'),
    paths = require('../paths.config.js'),
    karma = require('karma');

// run karma tests and coverage
gulp.task('unit', function () {
    new karma.Server({
        configFile: paths.karmaConf,
        singleRun: true,
        browsers: ['IE', 'Firefox', 'Chrome'],
        reporters: ['progress', 'coverage'],
        coverageReporter: {
            dir: paths.coverage,
            reporters: [
                { type: 'cobertura', subdir: '.', file: 'frontend.xml' }
            ]
        },
        preprocessors: {
            // source files, that you wanna generate coverage for
            // do not include tests or libraries
            // (these files will be instrumented by Istanbul)
            'Presentation.Web/app/**/!(*.spec|*.po).js': ['coverage']
        },
        autoWatch: false
    }).start();
});

// open coverage results.
gulp.task('localCover', ['localUnit'], function () {
    var open = require('gulp-open');

    gulp.src(paths.coverage + '/Phantom*/index.html')
        .pipe(open({
            app: 'chrome'
        }));
});

// run karma tests and coverage locally
gulp.task('localUnit', function (done) {
    new karma.Server({
        configFile: paths.karmaConf,
        singleRun: true,
        reporters: ['progress', 'coverage'],
        coverageReporter: {
            type: 'html',
            dir: paths.coverage
        },
        preprocessors: {
            // source files, that you wanna generate coverage for
            // do not include tests or libraries
            // (these files will be instrumented by Istanbul)
            'Presentation.Web/app/**/!(*.spec|*.po).js': ['coverage']
        },
        autoWatch: false
    }, done).start();
});

// run e2e tests with protractor
gulp.task('e2e', function () {
    var protractor = require('gulp-protractor').protractor;
    var browserstack = require('gulp-browserstack');

    var taskExitValue = 0;

    return gulp.src(paths.e2eFiles)
        .pipe(browserstack.startTunnel({
            key: process.env.BROWSERSTACK_KEY
        }))
        .pipe(protractor({
            configFile: 'protractor.conf.js'
        }))
        .on('error', function () {
            taskExitValue = 1;
            this.emit('end');
        })
        .pipe(browserstack.stopTunnel())
        .once('end', function () {
            // fix error where gulp is hanging after finish
            process.exit(taskExitValue);
        });
});

// publish coverage to codecov
gulp.task('codecov', function() {
    var codecov = require('gulp-codecov.io');

    return gulp.src('./coverage/*.xml')
        .pipe(codecov());
});
{'fraction_non_alphanumeric': 0.1493948562783661, 'fraction_numerical': 0.0018910741301059002, 'mean_word_length': 2.051933064050779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3770417', 'n_tokens_mistral': 1552, 'n_tokens_neox': 1517, 'n_words': 365}