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

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 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

1 participant