Skip to content

JSDOM initialization conflict #59

@tsapmic

Description

@tsapmic

GPXparser initialize jsdom when it finds that module is not defined:

if(typeof module !== 'undefined'){
    require('jsdom-global')();
    module.exports = gpxParser;
}

In case if dom will be configured somewhere else it could cause conflicts.

In my case: I have a Vue application using GPXParser and running tests with vitest causing double jsdom initialization.

Could you please change it to something like this:

if(typeof module !== 'undefined'){
    if (typeof document == 'undefined') {
        require('jsdom-global')();
    }
    module.exports = gpxParser;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions