Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): support cyclic metadata in TestBed overrides #44215

Closed
wants to merge 1 commit into from

Conversation

JoostK
Copy link
Member

@JoostK JoostK commented Nov 18, 2021

The TestBed APIs to override metadata would crash when the metadata
contained objects with cyclic references. Metadata overrides use the
JSON serialized representation of a value to compare objects, which
throws an error if the value has cyclic references. This commit avoids
the error by replacing multiple occurrences of the same object using
a unique string representation for the object.

Fixes #43948

The TestBed APIs to override metadata would crash when the metadata
contained objects with cyclic references. Metadata overrides use the
JSON serialized representation of a value to compare objects, which
throws an error if the value has cyclic references. This commit avoids
the error by replacing multiple occurrences of the same object using
a unique string representation for the object.

Fixes angular#43948
@JoostK JoostK added area: testing Issues related to Angular testing features, such as TestBed area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release labels Nov 18, 2021
@google-cla google-cla bot added the cla: yes label Nov 18, 2021
@ngbot ngbot bot modified the milestone: Backlog Nov 18, 2021
@JoostK JoostK marked this pull request as ready for review November 18, 2021 23:15
@JoostK JoostK added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 18, 2021
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @JoostK 👍

@AndrewKushnir AndrewKushnir removed the request for review from atscott November 18, 2021 23:32
@AndrewKushnir AndrewKushnir added action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 18, 2021
@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented Nov 18, 2021

Presubmit + Global Presubmit.

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Nov 19, 2021
@ngbot
Copy link

ngbot bot commented Nov 19, 2021

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "ci/circleci: legacy-unit-tests-saucelabs" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@AndrewKushnir AndrewKushnir added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Nov 19, 2021
@AndrewKushnir
Copy link
Contributor

Note to the Caretaker: global presubmit is "green" for this change. The legacy-unit-tests-saucelabs is likely failing for unrelated (pre-existing) reasons, so this PR is ready for merge.

@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit b930547.

jessicajaniuk pushed a commit that referenced this pull request Nov 19, 2021
The TestBed APIs to override metadata would crash when the metadata
contained objects with cyclic references. Metadata overrides use the
JSON serialized representation of a value to compare objects, which
throws an error if the value has cyclic references. This commit avoids
the error by replacing multiple occurrences of the same object using
a unique string representation for the object.

Fixes #43948

PR Close #44215
@angular-automatic-lock-bot
Copy link

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 Dec 20, 2021
dimakuba pushed a commit to dimakuba/angular that referenced this pull request Dec 28, 2021
The TestBed APIs to override metadata would crash when the metadata
contained objects with cyclic references. Metadata overrides use the
JSON serialized representation of a value to compare objects, which
throws an error if the value has cyclic references. This commit avoids
the error by replacing multiple occurrences of the same object using
a unique string representation for the object.

Fixes angular#43948

PR Close angular#44215
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: testing Issues related to Angular testing features, such as TestBed cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jest unit test fails when trying to override module with forRoot import
3 participants