tests: Send frontend test spec list as JSON

This commit is contained in:
Richard Hansen 2021-05-09 19:02:15 -04:00
parent 20df34bb67
commit d9782ac628
3 changed files with 3 additions and 6 deletions

View file

@ -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)));
});