diff --git a/app/assets/javascripts/discourse/testem.js b/app/assets/javascripts/discourse/testem.js index 4b45af6d18d..67261a0fb6d 100644 --- a/app/assets/javascripts/discourse/testem.js +++ b/app/assets/javascripts/discourse/testem.js @@ -78,8 +78,20 @@ if (process.argv.includes("-t")) { module.exports.proxies[`/*/theme-qunit`] = { target: `${target}${testPage}`, ignorePath: true, + xfwd: true, }; - module.exports.proxies["/*/*"] = { target }; + module.exports.proxies["/*/*"] = { target, xfwd: true }; + + module.exports.middleware = [ + function (app) { + // Make the testem.js file available under /assets + // so it's within the app's CSP + app.get("/assets/testem.js", function (req, res, next) { + req.url = "/testem.js"; + next(); + }); + }, + ]; } else if (shouldLoadPluginTestJs()) { // Running with ember cli, but we want to pass through plugin request to Rails module.exports.proxies = { diff --git a/app/views/qunit/theme.html.erb b/app/views/qunit/theme.html.erb index 05b281ac7e6..25ab0eff67a 100644 --- a/app/views/qunit/theme.html.erb +++ b/app/views/qunit/theme.html.erb @@ -29,7 +29,7 @@ <%- end %> <%- if params['testem'] %> - + <%- end %>