-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
Command
generate
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
The following line in a spec file
jasmine.clock().install().mockDate(new Date(startingTime));is transformed to
vi.useFakeTimers().mockDate(new Date(startingTime)); expected output:
vi.useFakeTimers().setSystemTime(new Date(startingTime));Minimal Reproduction
- follow steps on https://angular.dev/guide/testing/migrating-to-vitest
- call
ng g @schematics/angular:refactor-jasmine-vitest
example spec file:
describe('Foo', () => {
beforeEach(() => {
const startingTime = '1999-01-01T00:00:00.000Z';
jasmine.clock().install().mockDate(new Date(startingTime));
});
it('should be fine', () => {
expect(true).toBeTruthy();
});
});Exception or Error
Your Environment
Angular CLI : 21.0.0
Angular : 21.0.0
Node.js : 25.1.0 (Unsupported)
Package Manager : npm 11.6.3
Operating System : darwin arm64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular-devkit/core │ 21.0.0 │ 21.0.0 │
│ @angular/build │ 21.0.0 │ ^21.0.0 │
│ @angular/cdk │ 21.0.0 │ 21.0.0 │
│ @angular/cli │ 21.0.0 │ 21.0.0 │
│ @angular/common │ 21.0.0 │ 21.0.0 │
│ @angular/compiler │ 21.0.0 │ 21.0.0 │
│ @angular/compiler-cli │ 21.0.0 │ 21.0.0 │
│ @angular/core │ 21.0.0 │ 21.0.0 │
│ @angular/forms │ 21.0.0 │ 21.0.0 │
│ @angular/platform-browser │ 21.0.0 │ 21.0.0 │
│ @angular/platform-browser-dynamic │ 21.0.0 │ 21.0.0 │
│ @angular/router │ 21.0.0 │ 21.0.0 │
│ rxjs │ 7.8.2 │ 7.8.2 │
│ typescript │ 5.9.3 │ 5.9.3 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Metadata
Metadata
Assignees
Labels
No labels