Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

100% code coverage with no line numbers #931

Open
georgeben opened this issue Apr 16, 2020 · 0 comments
Open

100% code coverage with no line numbers #931

georgeben opened this issue Apr 16, 2020 · 0 comments

Comments

@georgeben
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant