Skip to content

Coverage report is not correct when Rollup Inject is used #2778

Open
@gian1200

Description

@gian1200

I'm currently migrating from Karma to Web-test-runner. When using Rollup Inject, some files get modified to include additional import lines. This additions are not taking into consideration when generating the coverage report. The result of this is that covered/uncovered lines are not correct (offset depending on the amount of lines added).

Examples

Karma (correct):

image

Web-test-runner:

image

Is this a bug, or is there any other plugin that may fix this issue?

Current plugins:

...
import rollupInject from "@rollup/plugin-inject";
import rollupLegacy from "@rollup/plugin-legacy";
import { fromRollup } from "@web/dev-server-rollup";

const inject = fromRollup(rollupInject);
const legacy = fromRollup(rollupLegacy);
...
"plugins": [
	legacy({
		"node_modules/jquery/dist/jquery.js": "$"
	}),
	inject({
		"$": "jquery",
		"fetchMock": "fetch-mock/esm/client",
		"Chart": ["chart.js/auto", "Chart"]
	})
]
...

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