Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Vitest requires assertion messages as the second argument to expect(), not as the last argument to matchers like Jasmine.

Changes

  • Migrated 421 assertion messages across 35 spec files
  • Excluded toHaveBeenCalledWith from transformation (all arguments are call parameters)
  • Handled both argument-taking matchers (toBe, toEqual) and no-arg matchers (toBeDefined, toBeTruthy)

Example

// Before (Jasmine)
expect(cells[0].value).toBe(147, 'wrong root level row');
expect(value).toBeDefined('should be defined');

// After (Vitest)
expect(cells[0].value, 'wrong root level row').toBe(147);
expect(value, 'should be defined').toBeDefined();

Implementation

Automated transformation using Python script that:

  • Parses expect statements with proper handling of nested parentheses, brackets, and string literals
  • Categorizes matchers by argument requirements
  • Moves string literal messages from matcher args to expect() second parameter

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 21, 2026 21:36
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor tests by moving to Vitest in initial commit fix(tests): migrate expect assertion messages to Vitest format Jan 21, 2026
Copilot AI requested a review from ChronosSF January 21, 2026 21:43
@ChronosSF ChronosSF marked this pull request as ready for review January 21, 2026 21:47
@ChronosSF ChronosSF merged commit 14736e5 into sstoychev/migrate-vitest Jan 21, 2026
@ChronosSF ChronosSF deleted the copilot/sub-pr-16781 branch January 21, 2026 21:47
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.

2 participants