fix: prevent production TDesign chunk cycles
Release / release (push) Canceled after 0s

This commit is contained in:
Qiufeng
2026-08-17 20:46:20 +08:00
parent 4f626da9db
commit 52403c6f95
8 changed files with 75 additions and 11 deletions
+29
View File
@@ -0,0 +1,29 @@
import { expect, test } from '@playwright/test';
test('release build boots the setup wizard without runtime errors', async ({ page }) => {
const pageErrors: string[] = [];
const consoleErrors: string[] = [];
page.on('pageerror', (error) => pageErrors.push(error.message));
page.on('console', (message) => {
if (message.type() === 'error') consoleErrors.push(message.text());
});
await page.route('**/api/v1/setup/status', async (route) => {
await route.fulfill({
json: {
data: {
required: true,
locked: false,
supportedDatabaseTypes: ['MYSQL'],
message: '请完成安装',
},
},
});
});
const response = await page.goto('/setup');
expect(response?.ok()).toBe(true);
await expect(page.getByRole('heading', { name: '安装向导', exact: true })).toBeVisible();
expect(pageErrors).toEqual([]);
expect(consoleErrors).toEqual([]);
});
+1
View File
@@ -18,6 +18,7 @@
"site:preview": "npm run build && cp -r dist _site",
"test": "vitest run",
"test:e2e": "playwright test",
"test:dist": "playwright test --config playwright.dist.config.ts",
"test:a11y": "playwright test e2e/accessibility.e2e.ts",
"audit:dependencies": "npm audit --audit-level=high --registry=https://registry.npmjs.org",
"check:production": "node scripts/check-production-hygiene.mjs",
+1
View File
@@ -6,6 +6,7 @@ const baseURL = `http://127.0.0.1:${port}`;
export default defineConfig({
testDir: './e2e',
testMatch: '**/*.e2e.ts',
testIgnore: 'dist-smoke.e2e.ts',
outputDir: 'test-results',
timeout: 30_000,
expect: { timeout: 8_000 },
+31
View File
@@ -0,0 +1,31 @@
import { defineConfig } from '@playwright/test';
const port = Number(process.env.PLAYWRIGHT_DIST_PORT || 3012);
const baseURL = `http://127.0.0.1:${port}`;
export default defineConfig({
testDir: './e2e',
testMatch: 'dist-smoke.e2e.ts',
outputDir: 'test-results-dist',
timeout: 30_000,
expect: { timeout: 8_000 },
fullyParallel: false,
workers: 1,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI ? [['list'], ['html', { open: 'never', outputFolder: 'playwright-report-dist' }]] : 'list',
use: {
baseURL,
locale: 'zh-CN',
timezoneId: 'Asia/Shanghai',
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
},
webServer: {
command: `npm run preview -- --host 127.0.0.1 --port ${port}`,
url: baseURL,
reuseExistingServer: false,
timeout: 120_000,
},
projects: [{ name: 'chromium-dist', use: { browserName: 'chromium', viewport: { width: 1366, height: 768 } } }],
});
-1
View File
@@ -55,7 +55,6 @@ export default ({ mode }: ConfigEnv): UserConfig => {
name: 'tdesign-vendor',
test: /node_modules[\\/]tdesign-(?:vue-next|icons-vue-next)[\\/]/,
priority: 30,
maxSize: 480 * 1024,
},
{
name: 'vue-vendor',