grunt-contrib-qunit
grunt-contrib-qunit copied to clipboard
Blocked by CORS policy
Trying to upgrade to v3.1, but I am getting the following error:
Access to XMLHttpRequest at 'file:///Users/dave/dev/iframe-resizer/src/iframeResizer.js?_=1550217744050' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https.
I can see this is an issue with the default settings of Chrome, so I added the flags to turn this error off, but that does not appear to be being passed through
puppeteer: {
args: [
'--disable-web-security',
'--allow-file-access-from-files',
'--user-data-dir=/tmp'
]
}
Following config worked for me:
puppeteer: {
ignoreDefaultArgs: true,
args: [
"--headless",
"--disable-web-security",
"--allow-file-access-from-files"
]
},
@davidjbradshaw Did you get this working? Can this issue be closed?
Ping @m-niesluchow @davidjbradshaw
I am also facing the same issue after upgrading to grunt-contrib-qunit v3.1, I have added the changes you suggested in my Gruntfile.js but issue still persists.
Could you specify exactly where these flags needed to be specified so that issue could get resolved.
@ossdev07 I am not working anymore on code, but version was "grunt-contrib-qunit": "^3.1.0"
and below is part of configuration.
grunt.initConfig({
...
qunit: {
options: {
puppeteer: {
ignoreDefaultArgs: true,
args: [
"--headless",
"--disable-web-security",
"--allow-file-access-from-files"
]
},
timeout: 10000
},
...
@m-niesluchow Thanks for the solution it worked for me.