DEV: handle ember-cli test proxying for relative roots

Allow tests to be able to be found and run
when DISCOURSE_RELATIVE_ROOT is set.
This commit is contained in:
Jeff Wong 2022-12-01 16:33:56 -08:00
parent 8437081d94
commit f0c8bc9e4d
1 changed files with 6 additions and 6 deletions

View File

@ -465,7 +465,7 @@ to serve API requests. For example:
app.use(rawMiddleware, async (req, res, next) => {
try {
if (this.shouldForwardRequest(req)) {
if (this.shouldForwardRequest(req, baseURL)) {
await handleRequest(proxy, baseURL, req, res);
} else {
// Fixes issues when using e.g. "localhost" instead of loopback IP address
@ -486,13 +486,13 @@ to serve API requests. For example:
});
},
shouldForwardRequest(request) {
shouldForwardRequest(request, baseURL) {
if (
[
"/tests/index.html",
"/ember-cli-live-reload.js",
"/testem.js",
"/assets/test-i18n.js",
`${baseURL}tests/index.html`,
`${baseURL}ember-cli-live-reload.js`,
`${baseURL}testem.js`,
`${baseURL}assets/test-i18n.js`,
].includes(request.path)
) {
return false;