Skip to content

Sourcemap get empty file with ts+karma #3

@kibbon

Description

@kibbon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions