Skip to content

refactor-jasmine-vitest: curried mockDate is not correctly transformed #31940

@jase88

Description

@jase88

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

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions