Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 4, 2025

Introduces a new --add-imports boolean option to the Jasmine to Vitest refactoring schematic.

When this option is set to true, the schematic will automatically add a single, consolidated import { ... } from 'vitest'; statement at the top of the transformed file for any Vitest APIs that are used.

Key changes:

  • Type-only imports (e.g., Mock, MockedObject) are now always added to ensure the refactored code remains type-correct.
  • Value imports (e.g., vi, describe, it, expect) are only added when --add-imports is true.
  • The import generation logic correctly handles all scenarios, including type-only imports (import type {...}), value-only imports, and combined imports with inline type keywords.
  • A new test suite has been added to validate the import generation logic under various conditions.

…chematic

Introduces a new `--add-imports` boolean option to the Jasmine to Vitest refactoring schematic.

When this option is set to `true`, the schematic will automatically add a single, consolidated `import { ... } from 'vitest';` statement at the top of the transformed file for any Vitest APIs that are used.

Key changes:
- Type-only imports (e.g., `Mock`, `MockedObject`) are now always added to ensure the refactored code remains type-correct.
- Value imports (e.g., `vi`, `describe`, `it`, `expect`) are only added when `--add-imports` is `true`.
- The import generation logic correctly handles all scenarios, including type-only imports (`import type {...}`), value-only imports, and combined imports with inline `type` keywords.
- A new test suite has been added to validate the import generation logic under various conditions.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Nov 4, 2025
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Nov 4, 2025
@clydin clydin merged commit cc132e9 into angular:main Nov 4, 2025
34 checks passed
@clydin
Copy link
Member Author

clydin commented Nov 4, 2025

This PR was merged into the repository. The changes were merged into the following branches:

@clydin clydin deleted the refactor/jasmine-vitest-imports branch November 4, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants