Skip to content

test: migrate from Jest to Vitest 4 - #97

Open
artall64 wants to merge 3 commits into
masterfrom
cursor/jest-to-vitest-4-cloud-6995
Open

artall64 wants to merge 3 commits into
masterfrom
cursor/jest-to-vitest-4-cloud-6995

Conversation

@artall64

@artall64 artall64 commented Sep 8, 2026

Copy link
Copy Markdown

Change Summary

What does this PR change?
Migrates the SDK test runner from Jest 30 to Vitest 4, keeping the same unit-test counts and snapshot bodies. Specs now use vi.* instead of jest.*, event-driven websocket cases wrap done() in Promises, and CI scripts call vitest run.

Related Issue/Ticket:
No PT9 ticket. Clean re-run of the jest-to-vitest-4 skill from 1inch/ai-dev-toolkit main after closing conflicting PR #88.

Testing & Verification

How was this tested?

  • Unit tests
  • Integration tests
  • Manual testing (describe steps)
  • Verified on staging

Unit: 36 files, 247 passed, 1 skipped (248) — same as the pre-migration Jest baseline. pnpm lint:ci exit 0 (7 pre-existing no-explicit-any warnings in src/ws-api/types.ts). pnpm lint:types and pnpm build exit 0.

Integration was not run: those specs need Docker plus Foundry artifacts under dist/contracts/. File collection for tests/**/*.spec.ts is unchanged (3 specs).

Risk Assessment

Risk Level:

  • Low - Minor changes, no operational impact
  • Medium - Moderate changes, limited impact, standard rollback available
  • High - Significant changes, potential operational impact, complex rollback

Risks & Impact
None. Test-runner and lint-preset only. No production SDK source changes. @1inch/eslint-config 5.0.0 → 5.1.0. NestJS coverage rules stay armed but dormant (pathIncludes does not match this SDK layout).

Made with Cursor

cursoragent and others added 3 commits September 8, 2026 15:01
The runner migration needs Vitest 4 and unplugin-swc in place of Jest,
@swc/jest, and the Jest type packages so later config and spec changes
can compile against the new stack.
Unit and integration runs need Vitest configs that preserve SWC
transforms, the ESM .js import alias, coverage reporters, and
testcontainers-length hook timeouts. Empty Jest global setup
stubs are unused under Vitest's named setup/teardown contract.
The remaining specs still called jest.* and used done() callbacks that
Vitest does not support. Rename to vi.*, wrap event-driven cases in
Promises, regenerate snapshots, and switch scripts plus the shared
@1inch/eslint-config/testing preset so CI runs the new stack.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2406c13. Configure here.

@@ -0,0 +1,20 @@
import {defineConfig} from 'vitest/config'
import base from './vitest.config.mjs'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Integration config imports missing file

Medium Severity

vitest.config.integration.mts imports ./vitest.config.mjs, but only vitest.config.mts exists. pnpm test:integration can fail during config load, so the integration runner is not reliably usable after the Jest removal.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2406c13. Configure here.

@cursor
cursor Bot requested review from mrkphpps and rharutyunyan September 8, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants