Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage drops to zero at certain configurations #66

Closed
Drachenfels opened this issue Nov 1, 2017 · 5 comments
Closed

Coverage drops to zero at certain configurations #66

Drachenfels opened this issue Nov 1, 2017 · 5 comments

Comments

@Drachenfels
Copy link

Hi there,

I do not have as yet fully working example (I mean reproduce-able bug that you can git clone), but what we know so far.

Everything works with configuration like this:

    grunt.initConfig({
        jasmine_node: {
            task_name: {
                options: {
                    coverage: {
                        reportFile: 'coverage.json',
                        relativize: true,
                        includeAllSources: false,
                        reportDir: 'coverage',
                        report: [
                            'lcov',
                            'text-summary'
                        ],
                        collect: [
                            '*coverage.json'
                        ]
                    },
                    jasmine: {
                        spec_dir: 'tests',
                        spec_files: [
                            '*spec.js'
                        ],
                        reporters: {
                            spec: {}
                        },
                        helpers: [
                            'helpers.js',
                        ],
                    },
                },
                src: [
                    'src/*.js',
                ]
            }
        }
    })

    grunt.loadNpmTasks('grunt-jasmine-node-coverage');
    grunt.registerTask('default', 'jasmine_node');

When you change:

src: [
    'src/*.js'
]

Into:

src: [
    'src/*.js',
    'src/*.js', 
]

Coverage is gone.

For that matter if you put more than one value on that list, coverage disappears.

Same happens when you change includeAllSources from false to true. Coverage is gone, despite the fact getting some results from istanbul.

When you remove 'src' section AND change includeAllSources from false to true, coverage is back but not on files that were actually executed by running tests, for those files it will be zero.

@Drachenfels
Copy link
Author

I tested against your repository, bug with multiple values on src attributes is confirmed, however one with includeAllSources I cannot reproduce, I will test more and let you know tomorrow.

@Drachenfels
Copy link
Author

Ok I have I got why second case when includeAllFiles causes to report no coverage was generated our helpers run this code:

function include(path) {
    var fs = require("fs"),
        vm = require('vm')

    vm.runInThisContext(fs.readFileSync(path, 'utf-8'), path);
}

Seems when you run vm.runInThisContext some stuff in global namespace got garbled. I will try to investigate tomorrow more.

@paazmaya
Copy link
Contributor

paazmaya commented Nov 2, 2017

@Drachenfels thanks for the issue, looks like an intereting challenge!

@Drachenfels
Copy link
Author

The second thing includeAllFiles might be not related to this plugin, something tells me that. However I did not figured it out exactly what is going on, so consider it a heads up not a confirmed issue. :-)

Thanks!

Good job with the plugin!

@paazmaya
Copy link
Contributor

paazmaya commented Apr 3, 2018

Closing as not confirmed to be a bug withing this project.
Re-open or create new issue when more details surface.

@paazmaya paazmaya closed this as completed Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants