diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js index 5573b6251..1b1fe8f55 100644 --- a/src/node/hooks/express/tests.js +++ b/src/node/hooks/express/tests.js @@ -30,7 +30,7 @@ const findSpecs = async (specDir) => { }; exports.expressCreateServer = (hookName, args, cb) => { - args.app.get('/tests/frontend/frontendTestSpecs.js', (req, res, next) => { + args.app.get('/tests/frontend/frontendTestSpecs.json', (req, res, next) => { (async () => { const modules = []; await Promise.all(Object.entries(plugins.plugins).map(async ([plugin, def]) => { @@ -53,8 +53,7 @@ exports.expressCreateServer = (hookName, args, cb) => { return aCore ? 1 : -1; }); console.debug('Sent browser the following test spec modules:', modules); - res.setHeader('content-type', 'application/javascript'); - res.end(`window.frontendTestSpecs = ${JSON.stringify(modules, null, 2)};\n`); + res.json(modules); })().catch((err) => next(err || new Error(err))); }); diff --git a/src/tests/frontend/index.html b/src/tests/frontend/index.html index 5c8f10206..178ba6030 100644 --- a/src/tests/frontend/index.html +++ b/src/tests/frontend/index.html @@ -23,7 +23,5 @@ - - diff --git a/src/tests/frontend/runner.js b/src/tests/frontend/runner.js index c6d2d9072..3100b13df 100644 --- a/src/tests/frontend/runner.js +++ b/src/tests/frontend/runner.js @@ -149,7 +149,7 @@ $(() => (async () => { // asynchronous form of require()). In addition, the performance gains would be minimal because // require-kernel only loads 2 at a time by default. (Increasing the default could cause problems // because browsers like to limit the number of concurrent fetches.) - for (const spec of window.frontendTestSpecs) { + for (const spec of await $.getJSON('frontendTestSpecs.json')) { const desc = spec .replace(/^ep_etherpad-lite\/tests\/frontend\/specs\//, ' ') .replace(/^([^/ ]*)\/static\/tests\/frontend\/specs\//, '<$1> ');