add Less styles support to test coverage

This commit is contained in:
Nacho Codoñer
2025-08-18 16:21:04 +02:00
parent 467cbe66d9
commit f0655bbef5
5 changed files with 26 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import {
Route,
createRoutesFromElements,
} from "react-router-dom";
import "./Global.less";
// Dynamically import components
const Home = lazy(() =>

View File

@@ -0,0 +1,3 @@
body {
white-space: break-spaces;
}

View File

@@ -17,12 +17,14 @@
"react-router-dom": "^7.0.0"
},
"devDependencies": {
"playwright": "^1.54.2",
"@babel/plugin-syntax-jsx": "^7.27.1",
"@babel/preset-env": "^7.23.5",
"@babel/preset-react": "^7.23.3",
"babel-plugin-react-compiler": "^19.1.0-rc.2",
"babel-loader": "^9.1.3"
"babel-loader": "^9.1.3",
"less": "^4.4.0",
"less-loader": "^12.3.0",
"playwright": "^1.54.2"
},
"meteor": {
"mainModule": {

View File

@@ -25,6 +25,15 @@ export default defineConfig(Meteor => {
],
type: 'javascript/auto',
},
{
test: /\.less$/,
use: [
{
loader: 'less-loader',
},
],
type: 'css/auto',
},
],
},
};

View File

@@ -9,7 +9,7 @@ import {
import { testMeteorBundler, testMeteorRspackBundler } from './test-helpers';
import fs from 'fs-extra';
import path from 'path';
import { assertMeteorReactApp } from "./assertions";
import { assertBodyStyles, assertMeteorReactApp } from "./assertions";
describe('ReactRouter App Bundling /', () => {
describe('Meteor+Rspack Bundler /', testMeteorRspackBundler({
@@ -25,6 +25,10 @@ describe('ReactRouter App Bundling /', () => {
await waitForReactEnvs(result.outputLines, { isJsxEnabled: true });
await waitForMeteorOutput(result.outputLines, /.*babel-plugin-react-compiler.*/);
await assert404Page(port);
// Less styles support
await assertBodyStyles({
'white-space': 'break-spaces',
});
},
afterRunRebuildClient: async ({ allConsoleLogs }) => {
// Check for HMR output as enabled by default
@@ -34,6 +38,10 @@ describe('ReactRouter App Bundling /', () => {
await waitForReactEnvs(result.outputLines, { isJsxEnabled: true });
await waitForMeteorOutput(result.outputLines, /.*babel-plugin-react-compiler.*/);
await assert404Page(port, { isProductionMode: true });
// Less styles support
await assertBodyStyles({
'white-space': 'break-spaces',
});
},
afterRunProductionRebuildClient: async ({ allConsoleLogs }) => {
// Check for HMR to not be enabled in production-like mode