Skip to content

Commit

Permalink
QUnit: Disable CORS check to avoid error.
Browse files Browse the repository at this point in the history
In some environments, QUnit fails with this error:

> Access to XMLHttpRequest at 'file:///wp-admin/admin-ajax.php' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https.

Requesting that endpoing via HTTP would require hardcoding a hostname, which would remove the ability of devs to use whatever hostname they want.

We don't need to worry about CORS in this context, so it's safe to disable it.

Fixes #51446
See gruntjs/grunt-contrib-qunit#158
Props garrett-eclipse
  • Loading branch information
iandunn committed Oct 7, 2020
1 parent af9db19 commit f853781
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,16 @@ module.exports = function(grunt) {
}
},
qunit: {
options: {
puppeteer: {
ignoreDefaultArgs: true,
args: [
"--headless",
"--disable-web-security",
"--allow-file-access-from-files"
]
},
},
files: [
'tests/qunit/**/*.html',
'!tests/qunit/editor/**'
Expand Down

0 comments on commit f853781

Please sign in to comment.