The current unit test approach relies on loading HTML files dynamically and updating the jQuery context. Loading the HTML file results in a GET request with the file protocol. Well, it seems both Firefox and Chrome's CORS (Cross-Origin Resource Sharing) policies are stricter.
Access to XMLHttpRequest at 'file:///.../SigTools/src/test/pages/datatables/single_row.html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
I think the error message is quite clear. The easiest solution, I can think of, is to launch a small server on development mode that serves the test HTML files. However, the server must also add the header Access-Control-Allow-Origin: * to all responses.
[x] Launch a local web server on /src/test, with a fixed port (customizable env environment is a bonus). Since with already have node, perhaps is the easiest way to create the said server
[x] Ensure the web server attaches Access-Control-Allow-Origin: * on all responses
Just lost 15 minutes because the browser was caching the test HTML file... if we implement the web server, I believe there is a header in the response to tell browsers "do not cache this resource"! Might be useful
The current unit test approach relies on loading HTML files dynamically and updating the jQuery context. Loading the HTML file results in a GET request with the
file
protocol. Well, it seems both Firefox and Chrome's CORS (Cross-Origin Resource Sharing) policies are stricter.I think the error message is quite clear. The easiest solution, I can think of, is to launch a small server on development mode that serves the test HTML files. However, the server must also add the header
Access-Control-Allow-Origin: *
to all responses./src/test
, with a fixed port (customizable env environment is a bonus). Since with already have node, perhaps is the easiest way to create the said serverAccess-Control-Allow-Origin: *
on all responsesI think this is enough!