Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

[bug] location of line is not match the source code #109

Open
Sara2009 opened this issue Sep 19, 2020 · 0 comments
Open

[bug] location of line is not match the source code #109

Sara2009 opened this issue Sep 19, 2020 · 0 comments

Comments

@Sara2009
Copy link

This is my webpack.config.js

module.exports = {
    module: {
        rule: [
            {
                test: /\.(ts|tsx)$/,
                exclude: /node_modules/,
                loader: 'babel-loader',
                options: {},
            },
            {
                test: /\.ts$|\.tsx$/,
                use: {
                    loader: 'istanbul-instrumenter-loader',
                    options: { esModules: true, produceSourceMap: true },
                },
               enforce: 'post',
               exclude: /node_modules|\.spec\.js$/,
           },
        ]
    }

}

But i found the loc is not correct.
In the file istanbul-instrumenter-loader/dist/index.js:
image
I found the source is dealed with babel.
image
So the AST is generated with the babel-resolved code not the real source code. So the fileCoverage is not correct. It does not match the real source code.

image

image

So i wonder how to solve this problem?

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