issue with cookiejar for localhost
ujjwalguptaofficial opened this issue · comments
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"
I don’t at all understand what it is that you want here. Are you proposing a change?
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.
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
})
}
}
}
});
};