Description
Hey,
I have some web components done with lit-element and want use web-test-runner for unit-testing.
As build system I’m using webpack and importing the scss via the lit-scss-loader ( https://www.npmjs.com/package/lit-scss-loader ).
In an ideal world, I could just use my webpack build for doing the unit tests via web-test-runner, but there seems no way to do so.
Currently I’m trying to get esbuild for web-test-runner as close as possible to my webpack config.
Everything seems to work fine, expect for scss.
I tried to use some rollup scss plugins, without success.
I found a configuration, where at least the tests running:
import { playwrightLauncher } from '@web/test-runner-playwright';
import { esbuildPlugin } from '@web/dev-server-esbuild';
export default {
nodeResolve: true,
manual: true,
open: true,
plugins: [esbuildPlugin({ ts: true, target: 'es2020', loaders: { '.scss': 'text' } })],
browsers: [
playwrightLauncher({
launchOptions: {
headless: false,
devtools: true,
slowMo: 10000
},
}),
],
};
With this configuration, my scss files are handles as text. That means I get the tests starting, but having in my browser scss code, instead of css.
web-test-runner seems to lack the option to transpile scss.
Is there a way to get scss working with web-test-runner or using my webpack build result?