Skip to content

Commit 1bdba06

Browse files
Copilothotlong
andcommitted
Optimize CI test duration: workspace split + slow test fixes
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 282a6b3 commit 1bdba06

File tree

6 files changed

+61
-23
lines changed

6 files changed

+61
-23
lines changed

apps/console/src/__tests__/BrowserSimulation.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ describe('Console Application Simulation', () => {
233233
// Check all labels exist concurrently using Promise.all for faster execution
234234
await Promise.all(
235235
fieldLabels.map(label =>
236-
waitFor(() => expectLabelToExist(label), { timeout: 12000 })
236+
waitFor(() => expectLabelToExist(label), { timeout: 5000 })
237237
)
238238
);
239239

apps/console/src/__tests__/Onboarding.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ describe('OnboardingWalkthrough', () => {
3737

3838
render(<OnboardingWalkthrough />);
3939

40-
// Wait a bit then verify it's not shown
41-
await new Promise(r => setTimeout(r, 1000));
42-
expect(screen.queryByText('Welcome to ObjectUI')).not.toBeInTheDocument();
40+
// Verify the dialog is not shown (no artificial delay needed)
41+
await waitFor(() => {
42+
expect(screen.queryByText('Welcome to ObjectUI')).not.toBeInTheDocument();
43+
});
4344
});
4445

4546
it('shows the first step initially', async () => {

packages/plugin-kanban/src/__tests__/performance-benchmark.test.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ describe('KanbanBoard (KanbanImpl): performance benchmarks', () => {
197197
expect(elapsed).toBeLessThan(500);
198198
});
199199

200-
it('renders 500 cards spread across 5 columns under 1,000ms', () => {
201-
const columns = generateColumns(5, 500);
200+
it('renders 200 cards spread across 5 columns under 1,000ms', () => {
201+
const columns = generateColumns(5, 200);
202202

203203
const start = performance.now();
204204
const { container } = render(<KanbanBoard columns={columns} />);
@@ -208,8 +208,8 @@ describe('KanbanBoard (KanbanImpl): performance benchmarks', () => {
208208
expect(elapsed).toBeLessThan(1_000);
209209
});
210210

211-
it('renders 1,000 cards spread across 5 columns under 2,000ms', () => {
212-
const columns = generateColumns(5, 1_000);
211+
it('renders 500 cards spread across 5 columns under 2,000ms', () => {
212+
const columns = generateColumns(5, 500);
213213

214214
const start = performance.now();
215215
const { container } = render(<KanbanBoard columns={columns} />);
@@ -219,8 +219,8 @@ describe('KanbanBoard (KanbanImpl): performance benchmarks', () => {
219219
expect(elapsed).toBeLessThan(2_000);
220220
});
221221

222-
it('renders with 20+ columns without degradation', () => {
223-
const columns = generateColumns(25, 250);
222+
it('renders with 10+ columns without degradation', () => {
223+
const columns = generateColumns(12, 120);
224224

225225
const start = performance.now();
226226
const { container } = render(<KanbanBoard columns={columns} />);
@@ -230,8 +230,8 @@ describe('KanbanBoard (KanbanImpl): performance benchmarks', () => {
230230
expect(elapsed).toBeLessThan(2_000);
231231
});
232232

233-
it('renders empty board with 20+ columns quickly', () => {
234-
const columns = generateColumns(25, 0);
233+
it('renders empty board with 10+ columns quickly', () => {
234+
const columns = generateColumns(12, 0);
235235

236236
const start = performance.now();
237237
const { container } = render(<KanbanBoard columns={columns} />);
@@ -260,11 +260,11 @@ describe('KanbanBoard (KanbanImpl): scaling characteristics', () => {
260260
await setupMocksAndImport();
261261
});
262262

263-
it('renders all column titles for 20+ column board', () => {
264-
const columns = generateColumns(25, 50);
263+
it('renders all column titles for 10+ column board', () => {
264+
const columns = generateColumns(12, 24);
265265
render(<KanbanBoard columns={columns} />);
266266

267-
for (let i = 0; i < 25; i++) {
267+
for (let i = 0; i < 12; i++) {
268268
expect(document.body.textContent).toContain(`Column ${i}`);
269269
}
270270
});
@@ -274,7 +274,7 @@ describe('KanbanBoard (KanbanImpl): scaling characteristics', () => {
274274
{
275275
id: 'badges-col',
276276
title: 'With Badges',
277-
cards: Array.from({ length: 500 }, (_, i) => ({
277+
cards: Array.from({ length: 100 }, (_, i) => ({
278278
id: `badge-card-${i}`,
279279
title: `Task ${i}`,
280280
badges: [
@@ -293,8 +293,8 @@ describe('KanbanBoard (KanbanImpl): scaling characteristics', () => {
293293
expect(elapsed).toBeLessThan(2_000);
294294
});
295295

296-
it('renders 1,000 cards across 10 columns under 2,000ms', () => {
297-
const columns = generateColumns(10, 1_000);
296+
it('renders 500 cards across 10 columns under 2,000ms', () => {
297+
const columns = generateColumns(10, 500);
298298

299299
const start = performance.now();
300300
const { container } = render(<KanbanBoard columns={columns} />);

packages/react/src/__tests__/LazyPluginLoader.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ describe('createLazyPlugin', () => {
166166

167167
await waitFor(() => {
168168
expect(screen.getByText('Success after retry')).toBeInTheDocument();
169-
}, { timeout: 5000 });
169+
}, { timeout: 2000 });
170170

171171
// First call + 2 retries (fails) + 1 success = called 3 times
172172
expect(importFn).toHaveBeenCalledTimes(3);

vitest.workspace.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineWorkspace } from 'vitest/config';
2+
3+
export default defineWorkspace([
4+
{
5+
extends: './vitest.config.mts',
6+
test: {
7+
name: 'unit',
8+
include: [
9+
'packages/core/src/**/*.test.ts',
10+
'packages/types/src/**/*.test.ts',
11+
'packages/cli/src/**/*.test.ts',
12+
'packages/data-objectstack/src/**/*.test.ts',
13+
],
14+
environment: 'node',
15+
setupFiles: [],
16+
testTimeout: 5000,
17+
},
18+
},
19+
{
20+
extends: './vitest.config.mts',
21+
test: {
22+
name: 'ui',
23+
include: [
24+
'packages/*/src/**/*.test.{ts,tsx}',
25+
'apps/*/src/**/*.test.{ts,tsx}',
26+
'examples/*/src/**/*.test.{ts,tsx}',
27+
],
28+
exclude: [
29+
'packages/core/src/**/*.test.ts',
30+
'packages/types/src/**/*.test.ts',
31+
'packages/cli/src/**/*.test.ts',
32+
'packages/data-objectstack/src/**/*.test.ts',
33+
'**/node_modules/**',
34+
'**/dist/**',
35+
'**/cypress/**',
36+
'**/e2e/**',
37+
'**/.{idea,git,cache,output,temp}/**',
38+
],
39+
},
40+
},
41+
]);

vitest.workspace.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)