JS-DevTools / coverage-istanbul-loader

Istanbul code coverage loader for Webpack
https://jstools.dev/coverage-istanbul-loader/
MIT License
32 stars 9 forks source link

Sourcemap get empty file with ts+karma #3

Open kibbon opened 4 years ago

kibbon commented 4 years ago

Seeing issues of istanbul-instrument-loader, I changed my depencies just got blank file: image Here if my config: karam.conf.js, use 'coverage-istanbul' reporter

 webpack: {
        mode: 'development',
        devtool: "inline-source-map",
        module: {
            rules: [
                {
                    test: /\.ts?$/,
                    // 指定源码位置
                    include: [path.join(__dirname, 'src')],
                    use: [
                        {
                            loader: "coverage-istanbul-loader",
                        },
                        {
                            loader: 'ts-loader',
                        },
                    ],
                    exclude: /node_modules/,
                }
            ],
        },
        resolve: {
            extensions: ['.ts', '.js', '.json']
        },
    },

tsconfig.json

 
{
  "compilerOptions": {
    "outDir": "./output",
    "target": "es2017",
    "module": "commonjs",
    "lib": ["es2015", "es2016", "es2017", "dom"],
    "allowJs": false,
    "jsx": "react",
    "declaration": true,
    "skipDefaultLibCheck": true,
    "skipLibCheck": true,
    "inlineSourceMap": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "noImplicitUseStrict": true,
    "noImplicitThis": true,
    "noUnusedLocals": false,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "baseUrl": ".",
  },
  "exclude": [
    "node_modules",
    "test",
    "lib"
  ]
}

The coverage report is not correct too: image Since I only tested 3 functional files, the right one is (using instrument-loader): image

ietabhi commented 4 years ago

+1