From 5d54c1657abd51ab58c2529c82650da405c8a30e Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 8 May 2021 18:56:26 -0400 Subject: [PATCH] tests: Redirect `/tests/frontend/index.html` to `/tests/frontend/` --- src/node/hooks/express/tests.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js index 551ff8ed..617d385c 100644 --- a/src/node/hooks/express/tests.js +++ b/src/node/hooks/express/tests.js @@ -28,6 +28,10 @@ exports.expressCreateServer = (hookName, args, cb) => { const rootTestFolder = path.join(settings.root, 'src/tests/frontend/'); + args.app.get('/tests/frontend/index.html', (req, res) => { + res.redirect(['./', ...req.url.split('?').slice(1)].join('?')); + }); + // The regexp /[\d\D]{0,}/ is equivalent to the regexp /.*/. The Express route path used here // uses the more verbose /[\d\D]{0,}/ pattern instead of /.*/ because path-to-regexp v0.1.7 (the // version used with Express v4.x) interprets '.' and '*' differently than regexp.