Skip to content

chore: faster twake-mui unit tests and npm cache in CI - #220

Merged
zatteo merged 2 commits into
mainfrom
chore/faster-tests
Oct 29, 2026
Merged

zatteo merged 2 commits into
mainfrom
chore/faster-tests

Conversation

@zatteo

@zatteo zatteo commented Oct 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Move the unit vitest project of twake-mui into its own vitest.unit.config.ts. npm test now runs it alone. vitest run --project unit still loaded vitest.config.ts, along with the storybook, argos and playwright plugins that the unit tests never use. vitest.config.ts lists the new file next to the storybook project, so npm run screenshots is unchanged.
  • Turn off per-file isolation for the unit project. Re-importing MUI for each of the 17 test files cost more than the tests themselves. The files pass in any order: 5 shuffled runs with 4 workers, 2 with 1 worker, plus 6 shuffle seeds during the earlier study.
  • Ask actions/setup-node to cache npm downloads (cache: 'npm') in the three CI/CD jobs, as argos.yml already does. Today npm ci takes 17–44 s.

Measures

Docker container with 4 CPU and 16 GB, like ubuntu-latest. Median of 3 paired runs of npm test --workspace=@linagora/twake-mui:

Before After
Wall time 4.3 s 2.3 s (0.51×)
CPU time 12.2 s 6.9 s
Test files / tests 17 / 123 17 / 123

The npm cache gain will show from the second run onwards, once a cache entry exists for the lockfile.

Test plan

  • npm run lint, npm run lint:fmt, npm run build
  • npm test: same 17 files and 123 tests, also with shuffled file order
  • vitest list --project storybook still finds the stories through vitest.config.ts
  • CI green, including the React 18 job

🤖 Generated with Claude Code

zatteo and others added 2 commits October 29, 2026 08:24
npm test ran vitest run --project unit, which still loads
vitest.config.ts and its storybook, argos and playwright plugins (about
1 s of startup the unit tests never use). The unit project now lives in
vitest.unit.config.ts: npm test runs it alone, vitest.config.ts lists it
next to the storybook project, so npm run screenshots is unchanged.

The unit project also stops isolating test files: re-importing MUI for
each of the 17 files cost more than the tests. They pass in any order
(shuffled runs, 1 and 4 workers).

Same 17 files and 123 tests; locally (4 CPU) 4.3 s -> 2.3 s, median of
3 runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setup-node only restores the npm cache when the package manager is set
in package.json; ask for it, so npm ci reuses the tarballs downloaded
by previous runs, as the Argos workflow already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f89687cf-52b1-496e-92b8-6a2cf385c490
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zatteo
zatteo merged commit 35c3004 into main Oct 29, 2026
6 checks passed
@zatteo
zatteo deleted the chore/faster-tests branch October 29, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant