Skip to content

Conversation

@0xjorgen
Copy link
Contributor

@0xjorgen 0xjorgen commented Dec 9, 2025

Motivation:
Fast unit tests are crucial for a good test writing experience. With AI, quick tests also let us iterate faster and run unit tests as part of workflow. Vite offers modern, easy-to-use testing tools and is notably faster.

Modification:
Migrate test runner from Jest to Vitest for significantly improved performance:

  • Frontend tests: 77.9s → 2.1s (37x faster)
  • API tests: 84.4s → 7.6s (11x faster)

ci
before
Screenshot 2025-12-09 at 11 41 03 UTC@2x

Screenshot 2026-01-06 at 18 56 03 UTC@2x

after:
Screenshot 2025-12-09 at 11 40 48 UTC@2x

Screenshot 2026-01-06 at 18 55 53 UTC@2x

Changes:

  • Add vitest.frontend.config.ts and vitest.api.config.ts
  • Use node environment by default, jsdom only for DOM-requiring tests
  • Convert jest.mock/fn/spyOn to vi.mock/fn/spyOn across 17 test files
  • Add setup.vitest.ts with TextEncoder polyfill
  • Inline @across-protocol/* packages to resolve ESM issues
  • Update package.json test scripts to use vitest

Co-Authored-By: Claude noreply@anthropic.com

@linear
Copy link

linear bot commented Dec 9, 2025

FE-213 Migrate to Vitest

@vercel
Copy link

vercel bot commented Dec 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
app-frontend-v3 Ready Ready Preview, Comment Jan 7, 2026 10:47am
sepolia-frontend-v3 Ready Ready Preview, Comment Jan 7, 2026 10:47am

Migrate test runner from Jest to Vitest for significantly improved performance:
- Frontend tests: 77.9s → 2.1s (37x faster)
- API tests: 84.4s → 7.6s (11x faster)

Changes:
- Add vitest.frontend.config.ts and vitest.api.config.ts
- Use node environment by default, jsdom only for DOM-requiring tests
- Convert jest.mock/fn/spyOn to vi.mock/fn/spyOn across 17 test files
- Add setup.vitest.ts with TextEncoder polyfill
- Inline @across-protocol/* packages to resolve ESM issues
- Update package.json test scripts to use vitest

Co-Authored-By: Claude <noreply@anthropic.com>
expect(token).toBeUndefined();
});

it("should return undefined for a zero address if the native token is not in the token map", () => {
Copy link
Contributor Author

@0xjorgen 0xjorgen Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test messed up the other with the nested mock.
If it is important, we can do the work of replacing it with another approach

@vercel
Copy link

vercel bot commented Dec 11, 2025

Deployment failed with the following error:

Hobby accounts are limited to daily cron jobs. This cron expression (* * * * *) would run more than once per day. Upgrade to the Pro plan to unlock all Cron Jobs features on Vercel.

Learn More: https://vercel.link/3Fpeeb1

# Conflicts:
#	test/api/_bridges/cctp-sponsored/utils/signing.test.ts
#	test/api/_bridges/cctp/strategy.test.ts
#	test/api/_bridges/oft-sponsored/utils/signing.test.ts
#	test/api/_bridges/sponsored-intent/common.test.ts
jorgen added 3 commits January 6, 2026 12:26
Copy link
Contributor

@dohaki dohaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Wanted to get off jest for a while now 👏 Only a few nits

@0xjorgen 0xjorgen merged commit c487a2c into master Jan 7, 2026
9 of 12 checks passed
@dohaki dohaki deleted the jorgen/fe-213-migrate-to-vitest branch January 7, 2026 12:12
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.

4 participants