Skip to content

Code coverage errors when using lodash templates #2825

Open
@miyasudokoro

Description

@miyasudokoro

I am maintaining some legacy code that uses lodash templating. When code coverage gets calculated, the following error is thrown repeatedly:

TypeError: Invalid URL
    at new URL (node:internal/url:775:36)
    at v8ToIstanbul (/var/jenkins_home/workspace/(redacted)/node_modules/@web/test-runner-coverage-v8/dist/index.js:52:21)
    ....

Debugging this shows that the value of entry.url is the string "lodash.templateSources[0]" for these errors.

I believe the best resolution of this is to skip all invalid URLs after checking them via URL.canParse.

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