Skip to content

Conversation

@jnizet
Copy link
Contributor

@jnizet jnizet commented Nov 22, 2025

The migration previously migrated jasmine.clock().mockDate() to vi.setSystemTime(), which does not compile because vi.setSystemTime() requires an argument. This commit fixes it by migrating jasmine.clock().mockDate() to vi.setSystemTime(new Date()).

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The migration previously migrated `jasmine.clock().mockDate()` to `vi.setSystemTime()`, which does not compile because `vi.setSystemTime()` requires an argument.
This commit fixes it by migrating `jasmine.clock().mockDate()` to `vi.setSystemTime(new Date())`.
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

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

Should this be new Date(0) so you get a consistent base time?

@jnizet
Copy link
Contributor Author

jnizet commented Nov 22, 2025

@atscott The documentation of Jasmine says that the default value is now.
So I chose to keep the same behavior in the migrated code.

@atscott
Copy link
Contributor

atscott commented Nov 22, 2025

Ah, yes. I guess any test which uses the default can’t actually depend on the date in any way except for how much time has passed (right?). Don’t know at that point if it’s better to do new Date(0) to signal that’s just a best practice to avoid an oopsie or to leave it as defaulting to now. Probably the latter I suppose if technically now could have been mocked beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants