Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion e2e/cases/css/tailwindcss-mjs/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export default {
plugins: {
'@tailwindcss/postcss': {},
'@tailwindcss/postcss': {
// Ensure tailwindcss only watch files in the current directory
base: import.meta.dirname,
},
},
};
5 changes: 4 additions & 1 deletion e2e/cases/css/tailwindcss-vendor-prefix/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
'@tailwindcss/postcss': {
// Ensure tailwindcss only watch files in the current directory
base: __dirname,
},
},
};
5 changes: 4 additions & 1 deletion e2e/cases/css/tailwindcss/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
'@tailwindcss/postcss': {
// Ensure tailwindcss only watch files in the current directory
base: __dirname,
},
},
};
11 changes: 10 additions & 1 deletion e2e/cases/server/overlay-type-errors/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import { dev, proxyConsole } from '@e2e/helper';
import { dev, proxyConsole, waitFor } from '@e2e/helper';
import { expect, test } from '@playwright/test';

const cwd = __dirname;

test('should display type errors on overlay correctly', async ({ page }) => {
const { restore } = proxyConsole();

const logs: string[] = [];
page.on('console', (consoleMessage) => {
logs.push(consoleMessage.text());
});

const rsbuild = await dev({
cwd,
page,
});

expect(
await waitFor(() => logs.some((log) => log.includes('TS2322:'))),
).toBeTruthy();

const errorOverlay = page.locator('rsbuild-error-overlay');

await expect(errorOverlay.locator('.title')).toHaveText('Build failed');
Expand Down
17 changes: 16 additions & 1 deletion e2e/cases/server/overlay/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import { join } from 'node:path';
import { dev, proxyConsole } from '@e2e/helper';
import { dev, proxyConsole, waitFor } from '@e2e/helper';
import { expect, test } from '@playwright/test';

const cwd = __dirname;
Expand All @@ -17,6 +17,11 @@ test('should show overlay correctly', async ({ page }) => {
recursive: true,
});

const logs: string[] = [];
page.on('console', (consoleMessage) => {
logs.push(consoleMessage.text());
});

const rsbuild = await dev({
cwd,
page,
Expand All @@ -29,6 +34,10 @@ test('should show overlay correctly', async ({ page }) => {
},
});

expect(
await waitFor(() => logs.some((log) => log.includes('[HMR] connected.'))),
).toBeTruthy();

const errorOverlay = page.locator('rsbuild-error-overlay');

expect(await errorOverlay.locator('.title').count()).toBe(0);
Expand All @@ -40,6 +49,12 @@ test('should show overlay correctly', async ({ page }) => {
fs.readFileSync(appPath, 'utf-8').replace('</div>', '</aaaaa>'),
);

expect(
await waitFor(() =>
logs.some((log) => log.includes('Module build failed')),
),
).toBeTruthy();

await expect(errorOverlay.locator('.title')).toHaveText('Build failed');

await rsbuild.close();
Expand Down