Skip to content

Coverage with Webpack not work #474

Open
@Merynek

Description

@Merynek

I have this config:
It works but coverage is on test files only. So 100% :-)).
I need coverage only on .ts files, but I dont know how set preprocessor only to .ts files.

module.exports = function (config) {
    config.set({
        frameworks: ["jasmine", "webpack"],
        reporters: ['progress', 'coverage'],
        files: [
            {
                pattern: `${outputPath}/**/*`,     // <-- here
                watched: false,
                included: false
            },
            "./test/boot.spec.ts",
            "./src/app/**/*.ts", // *.tsx for React Jsx
            "./test/**/*.ts" // *.tsx for React Jsx
        ],
        preprocessors: {
            // add webpack as preprocessor
            'test/**/*.ts': ['webpack', 'coverage']
        },
        coverageReporter: {
            type : 'html',
            dir : '../coverage/Pico'
        },
        webpack: webpackConfig,
        browsers: ["Chrome"],
        logLevel: config.LOG_ERROR
    });
};

I try this:

module.exports = function (config) {
    config.set({
        frameworks: ["jasmine", "webpack"],
        reporters: ['progress', 'coverage'],
        files: [
            {
                pattern: `${outputPath}/**/*`,     // <-- here
                watched: false,
                included: false
            },
            "./test/boot.spec.ts",
            "./src/app/**/*.ts", // *.tsx for React Jsx
            "./test/**/*.ts" // *.tsx for React Jsx
        ],
        preprocessors: {
            // add webpack as preprocessor
            'test/**/*.ts': ['webpack'],
            "./src/app/**/*.ts": ['webpack', 'coverage']
        },
        coverageReporter: {
            type : 'html',
            dir : '../coverage/Pico'
        },
        webpack: webpackConfig,
        browsers: ["Chrome"],
        logLevel: config.LOG_ERROR
    });
};

But I got error: ultiple assets emit different content to the same filename on assets, bcs Loaded more than once.

Any Idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions