Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with cookiejar for localhost #38

Open
ujjwalguptaofficial opened this issue Aug 23, 2022 · 3 comments
Open

issue with cookiejar for localhost #38

ujjwalguptaofficial opened this issue Aug 23, 2022 · 3 comments

Comments

@ujjwalguptaofficial
Copy link

When runing the test i am getting this issue -

Cookie has domain set to the public suffix "localhost" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}

On further investigation its because of the url being set inside jsdom launcher when initiating jsdom -

 jsdom.JSDOM.fromURL(url, jsdomOptions).then(function (dom) {
        self.window = dom.window;
      });

the url value is coming from karma which is localhost:9876/debug.html

if i change the value of url it works - Can you please take the url from the configuration and if not provided then use the url from karma.

package version -

"karma-jsdom-launcher": "^13.0.0",
"jsdom": "^20.0.0"

@badeball
Copy link
Owner

badeball commented Aug 23, 2022

I don’t at all understand what it is that you want here. Are you proposing a change?

@badeball
Copy link
Owner

I have no desire anymore to investigate any issues with this package, but if you want to propose a change through a PR you may, but make sure to add a test to illustrate what the problem is.

@814k31
Copy link

814k31 commented Aug 14, 2023

This issue is a little old now but for anyone else
it looks like it was answered here:
jsdom/jsdom#3419 (comment)

so for use with this plugin:

// karma.conf.js
const jsdom = require('jsdom');

module.exports = function (config) {
    config.set({
        // ... other options
        jsdomLauncher: {
            jsdom: {
                testEnvironmentOptions: {
                    cookieJar: new jsdom.CookieJar(undefined, {
                        allowSpecialUseDomain: true
                    })
                }
            }
        }
    });
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants