gotwarlost/istanbul

100% code coverage with no line numbers

georgeben opened this issue · 0 comments

I'm trying to add tests coverage to a node project which uses babel as a transpiler. Here is my .babelrc file

{
  "presets": [
    "es2015"
  ]
}

My tests are located in the ./test/integration folder.

Here's my gulp setup

const paths = {
    js: [
        "./**/*.js",
        "!dist/**",
        "!node_modules/**",
        "!test/**",
        "!coverage/**",
        "!log/**"
    ],
    files: ["./package.json", "./.gitignore"],
    tests: {
        integration: "./test/integration/**/*.js",
        unit: "./test/unit/**/*.js"
    },
    build: "dist"
};

gulp.task("test", () =>
    gulp
        .src(["dist/app/**/*js"])
        .pipe(plugins.plumber())
        .pipe(plugins.istanbul())
        .pipe(plugins.istanbul.hookRequire())
        .on("finish", () =>
            gulp
                .src("./test/**/*.js")
                .pipe(
                    plugins.mocha({
                        reporter: "spec",
                        ui: "bdd",
                        recursive: true,
                        exit: true,
                        timeout: 60000,
                        compilers: {
                            js: babelCompiler
                        }
                    })
                )
                .pipe(plugins.istanbul.writeReports(opt))
                .pipe(
                    plugins.istanbul.enforceThresholds({
                        thresholds: { global: 90 }
                    })
                )
                .on("end", () =>
                    console.log(
                        ">>>>>>>>>>>>>> Finished Running Tests <<<<<<<<<<<<<<"
                    )
                )
                .pipe(plugins.exit())
        )
);

All the tests run, but this is the report from istanbul

Screen Shot 2020-04-16 at 9 42 24 AM

Please what am I doing wrong?