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,