diff --git a/tests/runner/createTestServer.js b/tests/runner/createTestServer.js index 67770c71d8..6f409bea2f 100644 --- a/tests/runner/createTestServer.js +++ b/tests/runner/createTestServer.js @@ -23,8 +23,9 @@ export async function createTestServer( report ) { // Add a script tag to HTML pages to load the QUnit listeners app.use( /\/tests\/unit\/([^/]+)\/\1\.html$/, async( req, res ) => { + const moduleEscaped = req.params[ 0 ].replace( /[^a-z0-9_-]/gi, "" ); const html = await readFile( - `tests/unit/${ req.params[ 0 ] }/${ req.params[ 0 ] }.html`, + `tests/unit/${ moduleEscaped }/${ moduleEscaped }.html`, "utf8" ); res.send(