Skip to content

feat(core): remove TestBed.get - #60414

Closed
crisbeto wants to merge 2 commits into
angular:mainfrom
crisbeto:test-bed-get-removal
Closed

feat(core): remove TestBed.get#60414
crisbeto wants to merge 2 commits into
angular:mainfrom
crisbeto:test-bed-get-removal

Conversation

@crisbeto

@crisbeto crisbeto commented Mar 17, 2025

Copy link
Copy Markdown
Member

TestBed.get isn't type safe and has been deprecated for several years now. These changes remove it from the public API.

BREAKING CHANGE:

  • TestBed.get has been removed. Use TestBed.inject instead.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release labels Mar 17, 2025
@angular-robot angular-robot Bot added detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit area: core Issues related to the framework runtime area: migrations Issues related to `ng update`/`ng generate` migrations labels Mar 17, 2025
@ngbot ngbot Bot added this to the Backlog milestone Mar 17, 2025
@crisbeto
crisbeto force-pushed the test-bed-get-removal branch from 2b0888a to db7c556 Compare March 17, 2025 09:14
`TestBed.get` isn't type safe and has been deprecated for several years now. These changes remove it from the public API and a follow-up change will add an automated migration to `TestBed.inject`.

BREAKING CHANGE:
* `TestBed.get` has been removed. Use `TestBed.inject` instead.
Adds a migration that will move users off the deprecated `TestBed.get` method.
@crisbeto
crisbeto force-pushed the test-bed-get-removal branch from db7c556 to 2abad2f Compare March 17, 2025 09:16
@crisbeto
crisbeto requested a review from devversion March 17, 2025 09:38
@crisbeto
crisbeto marked this pull request as ready for review March 17, 2025 09:38

@pkozlowski-opensource pkozlowski-opensource left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: fw-general
Reviewed-for: fw-security

@devversion devversion left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: public-api

@jelbourn jelbourn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: fw-security

@pullapprove
pullapprove Bot requested review from AndrewKushnir and kirjs March 17, 2025 14:55
@crisbeto crisbeto added the action: global presubmit The PR is in need of a google3 global presubmit label Mar 17, 2025

@josephperrott josephperrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: fw-security

);

await runMigration();
expect(tree.readContent('/test.ts')).toContain(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Super nit, but maybe expect it not to contain TestBed.get?

@pullapprove
pullapprove Bot requested a review from atscott March 17, 2025 21:05

@AndrewKushnir AndrewKushnir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed-for: public-api

@crisbeto

Copy link
Copy Markdown
Member Author

Passing TGP, once a handful of clients are cleaned up.

@crisbeto crisbeto removed the action: global presubmit The PR is in need of a google3 global presubmit label Mar 18, 2025
@crisbeto crisbeto added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Mar 18, 2025
@crisbeto
crisbeto removed request for alxhub and atscott March 18, 2025 08:03
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: merge The PR is ready for merge by the caretaker labels Mar 18, 2025
@pkozlowski-opensource

Copy link
Copy Markdown
Member

This PR was merged into the repository by commit 34f0453.

The changes were merged into the following branches: main

pkozlowski-opensource pushed a commit that referenced this pull request Mar 19, 2025
Adds a migration that will move users off the deprecated `TestBed.get` method.

PR Close #60414
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime area: migrations Issues related to `ng update`/`ng generate` migrations detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants