Skip to content
This repository was archived by the owner on Mar 26, 2021. It is now read-only.
This repository was archived by the owner on Mar 26, 2021. It is now read-only.

sloc value is different from that reported by gulp-sloc due to not showing _All_ files #47

Open

Description

@Smurf-IV

gulp-sloc reports this:

    physical lines : 21163

lines of source code : 16045
total comment : 2533
singleline : 1044
multiline : 1489
empty : 2585

number of files read : 65

strict mode

gulp-coverage reports this:
"sloc": 3587,
"ssoc": 6711,
"sboc": 1251,
"coverage": 37.97044884304432,
"statements": 35.2853524064968,
"blocks": 27.018385291766588,
And lists only 35 files

Why are files missing ?

FYI:
Notice that the source lists are the same
// ==========================
gulp.task('linesOfCode', function(){
gulp.src(['./../Server/source//.js'])
.pipe(sloc());
});
// ==========================
gulp.task('nodeuniter', ['clean_uniter'], function () {
var stream = gulp.src(['./testing/
.js'], {read: false})
.pipe(cover.instrument({
pattern: ['./../Server/source/
/*.js'],
debugDirectory: './.debug'
}))
.pipe(nodeunit({
reporter: 'junit',
reporterOptions: {
output: './.unitReport'
}
}))
.pipe(cover.gather())
.pipe(cover.format([{reporter: 'html'}, {reporter: 'json'}]))
.pipe(gulp.dest('./.covReport'));
return stream;
});
// ==========================

Activity

  1. Smurf-IV commented on Jan 18, 2016

    @Smurf-IV
    Author

    So found out that if the gulp.src does not load the files, then they will not be included in the coverage calculation,
    i.e. if the following does not require a code file then it will not be piped into the instrument step

    var stream = gulp.src(['./testing/*.js'], {read: false})

    makes sense

    So I tried this line

    var stream = gulp.src(['./testing/_loadAllSource.js'], {read: false})

    which has the following in the code

    var modules = require('require-dir-all')(
    path.resolve(__dirname, '../../Server/source'),
    {
    recursive: true,
    includeFiles: /^.*.(js)$/,
    excludeDirs: /^(.git|.svn|node_modules)$/
    }
    );

    BUT
    That attempts to start my server code, which is not the point, as the Unit tests should be loading just the bits they need in a standalone fashion.

    So what is needed is some way of getting all the target files into the instrument step without them starting up or loading files etc.

  2. dylanb commented on Jan 24, 2016

    @dylanb
    Owner

    This module will only give you coverage stats for files that are tested with unit tests. That is a current limitation. Are there files that are being tested with unit tests that are being excluded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions