[wp-trac] [WordPress Trac] #51446: CORS issues with QUnit while running tests

WordPress Trac noreply at wordpress.org
Mon Oct 5 04:01:48 UTC 2020


#51446: CORS issues with QUnit while running tests
-------------------------+-------------------------------------------------
 Reporter:  garrett-     |      Owner:  (none)
  eclipse                |
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:  has-patch needs-testing dev-
  Focuses:  javascript   |  feedback
-------------------------+-------------------------------------------------
 Hello,

 For a while I've been having an error when running `grunt test` with the
 qunit tests;
 {{{
 Running "qunit:files" (qunit) task
 Testing tests/qunit/compiled.html
 ......................................................................................................................................................................................................................................................................................................OK
 Testing tests/qunit/index.html 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.
 Failed to load resource: net::ERR_FAILED
 ......................................................................................................................................................................................................................................................................................................OK
 >> 588 tests completed with 0 failed, 0 skipped, and 0 todo.
 >> 1738 assertions (in 8024ms), passed: 1738, failed: 0
 }}}

 Looking into this a little I was able to resolve these by updating the
 `tests/qunit/index.html` to use localhost for the ajax urls.

 Uploading patch but am unsure if it's the correct action, seems to work
 nicely for me at least and suppresses the error.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51446>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list