From d84d78cab5243113927a7dc8db96a73170394b01 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 2 Jan 2025 13:04:39 -0500 Subject: [PATCH] add middleware to follow new stylesheet imports --- web-test-runner.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web-test-runner.config.js b/web-test-runner.config.js index 76024dfb3..0ce1a4570 100644 --- a/web-test-runner.config.js +++ b/web-test-runner.config.js @@ -38,6 +38,16 @@ export default { bail: process.env['FAIL_FAST'] === 'true', }, }, + middleware: [ + // When using relative CSS imports, we need to rewrite the paths so the test runner can find them. + function rewriteCssUrls(context, next) { + if (context.url.endsWith('.css') && context.url.match(/^\/[^/]+\//)) { + const theme = context.url.split('/')[1]; + context.url = `/dist/styles/themes/${theme}${context.url.slice(theme.length + 1)}`; + } + return next(); + }, + ], plugins: [ esbuildPlugin({ ts: true,