istanbuljs / babel-plugin-istanbul

A babel plugin that adds istanbul instrumentation to ES6 code
BSD 3-Clause "New" or "Revised" License
624 stars 73 forks source link

just one file has coverage data #203

Closed 6ququ6 closed 5 years ago

6ququ6 commented 5 years ago

first,I user the command:npm install --save-dev babel-plugin-istanbul then, I add this in my repo(React native app): image finally,I use istanbul-middleware to see the report image however,there is only one file(index.android.js) has coverage data, other .js files have no coverage image so, I am wondering: are there some implicit rules in babel istanbul-plugin, which can make this happen?

coreyfarrell commented 5 years ago

I cannot help based on a couple of redacted images. Please provide a minimum reproduction repository showing the issue happening.

Further istanbul-middleware uses istanbul@0.4.x which is a deprecated / unmaintained predecessor to the current software. It will cause problems.

6ququ6 commented 5 years ago

https://github.com/6dingdong6/app this is url, you can download the zip. Thanks! @coreyfarrell

coreyfarrell commented 5 years ago

I'm sorry I cannot work with an archive, please push a git repository.

6ququ6 commented 5 years ago

I'm sorry I cannot work with an archive, please push a git repository.

I just pushed a git repository, please try again

coreyfarrell commented 5 years ago

Thanks for posting this. TBH a smaller reproduction is likely to get see someone digging deeper. I can't test this on my system but one thing I noticed is your .babelrc has:

        ["istanbul",{
            "include":[
                "./Components/Module/Designer/*/*"
            ]
}],

The include setting should be ["Components/Module/Designer/*/*"] or possibly ["Components/Module/Designer/**"]. The current versions of include/exclude matching do not properly handle globs that explicitly start with ./.

6ququ6 commented 5 years ago

"Components/Module/Designer//" is correct! Thanks! But I am still wondering, when I don't use the include setting: ["istanbul"], the report just shows one file's coverage data; use the include setting:["istanbul",{ "include":[ "Components/Module/Designer/*/*" ] }], then the report contains every file's coverage data.