in scripts/testHarness.js [19:55]
configureServer(server) {
server.middlewares.use(async (req, res, next) => {
let url = null;
try {
url = decodeURI(req.url);
} catch (error) {
// catch the use of <%= path %>
if (req.url.includes('%3C%=%20path%20%%3E')) {
console.error('The use of <%= path %> is not supported in this template. Please use __assetsPath__ instead')
}
console.error('Invalid url:', req.url);
return next();
}
const path = normalizePath(url);
if (path === '/' || path.startsWith('/atoms/')) {
let template = await plugin.load(path);
if (!template) {
console.log('Could not find html for path', path);
return next();
}
let mainHTML = await loadMainHTML(path, server);
if (mainHTML) {
mainHTML = await server.transformIndexHtml('/', mainHTML);
}
// Apply lodash templating
const result = await plugin.transformTemplateHTML(template, mainHTML, path);
res.end(result);
} else {
return next();
}
});
},