[Unzyme] src/core/packages/apps#217599
Conversation
|
Pinging @elastic/kibana-core (Team:Core) |
💚 Build Succeeded
Metrics [docs]
|
|
|
||
| import React from 'react'; | ||
| import { shallow } from 'enzyme'; | ||
| import { mountWithIntl } from '@kbn/test-jest-helpers'; |
There was a problem hiding this comment.
This library uses enzyme under the hood. @Dosant, are we planning to migrate @kbn/test-jest-helpers to RTL?
There was a problem hiding this comment.
I am not sure how this will look like, but we likely won't be able to internally migrate this helper without touching the actual test case code.
We should probably create a separate package for most common react testing library cases (if doesn't exist yet) and deprecate these functions.
For now, I'd either use react testing library directly or this wrapper
There was a problem hiding this comment.
LGTM we should be using @kbn/test-jest-helpers anyways since it has the custom centralized code written by the core team for testing i18n
I don't think we should.
I don't think we will be able to migrate mountWithIntl internally to use testing library without rewriting the test cases.
imo, mountWithIntl should be marked as deprecated just as any other enzyme api and another common util needs to be created and used instead ( or maybe just
, but we should name it nicer since it will be a default)
Bamieh
left a comment
There was a problem hiding this comment.
LGTM we should be using @kbn/test-jest-helpers anyways since it has the custom centralized code written by the core team for testing i18n
|
Starting backport for target branches: 9.0 https://github.com/elastic/kibana/actions/runs/14360397839 |
## Summary Fix elastic#217589 Related to elastic#217387 Migrates `metric_tiles` and `status_table` unit tests from `enzyme` snapshot tests to explicit assertions using `RTL`. Explicit assertions have the advantage of being more readable, targeted, reducing noise due to unrelated changes (e.g. EUI updates) and to make debugging easier. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 50ddab4)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `9.0`: - [[Unzyme] src/core/packages/apps (#217599)](#217599) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Christiane (Tina) Heiligers","email":"christiane.heiligers@elastic.co"},"sourceCommit":{"committedDate":"2025-04-09T14:57:29Z","message":"[Unzyme] src/core/packages/apps (#217599)\n\n## Summary\n\nFix https://github.com/elastic/kibana/issues/217589\nRelated to #217387\n\nMigrates `metric_tiles` and `status_table` unit tests from `enzyme`\nsnapshot tests to explicit assertions using `RTL`. Explicit assertions\nhave the advantage of being more readable, targeted, reducing noise due\nto unrelated changes (e.g. EUI updates) and to make debugging easier.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"50ddab4418c7f53cdb5c3690e556dac79ab3c4eb","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:prev-minor","v9.1.0"],"title":"[Unzyme] src/core/packages/apps","number":217599,"url":"https://github.com/elastic/kibana/pull/217599","mergeCommit":{"message":"[Unzyme] src/core/packages/apps (#217599)\n\n## Summary\n\nFix https://github.com/elastic/kibana/issues/217589\nRelated to #217387\n\nMigrates `metric_tiles` and `status_table` unit tests from `enzyme`\nsnapshot tests to explicit assertions using `RTL`. Explicit assertions\nhave the advantage of being more readable, targeted, reducing noise due\nto unrelated changes (e.g. EUI updates) and to make debugging easier.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"50ddab4418c7f53cdb5c3690e556dac79ab3c4eb"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217599","number":217599,"mergeCommit":{"message":"[Unzyme] src/core/packages/apps (#217599)\n\n## Summary\n\nFix https://github.com/elastic/kibana/issues/217589\nRelated to #217387\n\nMigrates `metric_tiles` and `status_table` unit tests from `enzyme`\nsnapshot tests to explicit assertions using `RTL`. Explicit assertions\nhave the advantage of being more readable, targeted, reducing noise due\nto unrelated changes (e.g. EUI updates) and to make debugging easier.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"50ddab4418c7f53cdb5c3690e556dac79ab3c4eb"}}]}] BACKPORT--> Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
## Summary fix #217589 again The implementation in #217599 for the status table still relied on enzyme indirectly by using `mountWithI18n`. This PR refactors the test from implementing the enzyme-reliant helper to using `renderReactTestingLibraryWithI18n` that doesn't. ## Note to reviewers: If `renderReactTestingLibraryWithI18n` becomes the standard, renaming it to something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the helper's only used in 13 files and it would be better to do so now that when adoption becomes wide-spread. The package is owned by `shared-ux` and renaming the function would require code-reviews from too many teams to justify doing so in this PR. ### Checklist Check the PR satisfies following conditions. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary fix elastic#217589 again The implementation in elastic#217599 for the status table still relied on enzyme indirectly by using `mountWithI18n`. This PR refactors the test from implementing the enzyme-reliant helper to using `renderReactTestingLibraryWithI18n` that doesn't. ## Note to reviewers: If `renderReactTestingLibraryWithI18n` becomes the standard, renaming it to something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the helper's only used in 13 files and it would be better to do so now that when adoption becomes wide-spread. The package is owned by `shared-ux` and renaming the function would require code-reviews from too many teams to justify doing so in this PR. ### Checklist Check the PR satisfies following conditions. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit c45f791)
## Summary fix elastic#217589 again The implementation in elastic#217599 for the status table still relied on enzyme indirectly by using `mountWithI18n`. This PR refactors the test from implementing the enzyme-reliant helper to using `renderReactTestingLibraryWithI18n` that doesn't. ## Note to reviewers: If `renderReactTestingLibraryWithI18n` becomes the standard, renaming it to something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the helper's only used in 13 files and it would be better to do so now that when adoption becomes wide-spread. The package is owned by `shared-ux` and renaming the function would require code-reviews from too many teams to justify doing so in this PR. ### Checklist Check the PR satisfies following conditions. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…218491) # Backport This will backport the following commits from `main` to `9.0`: - [[Unzyme] Migrates status_table of enzyme completely (#218361)](#218361) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Christiane (Tina) Heiligers","email":"christiane.heiligers@elastic.co"},"sourceCommit":{"committedDate":"2025-04-16T20:23:28Z","message":"[Unzyme] Migrates status_table of enzyme completely (#218361)\n\n## Summary\nfix #217589 again\nThe implementation in #217599 for\nthe status table still relied on enzyme indirectly by using\n`mountWithI18n`.\n\nThis PR refactors the test from implementing the enzyme-reliant helper\nto using `renderReactTestingLibraryWithI18n` that doesn't.\n\n## Note to reviewers:\nIf `renderReactTestingLibraryWithI18n` becomes the standard, renaming it\nto something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the\nhelper's only used in 13 files and it would be better to do so now that\nwhen adoption becomes wide-spread.\n\nThe package is owned by `shared-ux` and renaming the function would\nrequire code-reviews from too many teams to justify doing so in this PR.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"c45f791ddb3917fb13d978fc53a3a440bf9505b5","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","v9.1.0"],"title":"[Unzyme] Migrates status_table of enzyme completely","number":218361,"url":"https://github.com/elastic/kibana/pull/218361","mergeCommit":{"message":"[Unzyme] Migrates status_table of enzyme completely (#218361)\n\n## Summary\nfix #217589 again\nThe implementation in #217599 for\nthe status table still relied on enzyme indirectly by using\n`mountWithI18n`.\n\nThis PR refactors the test from implementing the enzyme-reliant helper\nto using `renderReactTestingLibraryWithI18n` that doesn't.\n\n## Note to reviewers:\nIf `renderReactTestingLibraryWithI18n` becomes the standard, renaming it\nto something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the\nhelper's only used in 13 files and it would be better to do so now that\nwhen adoption becomes wide-spread.\n\nThe package is owned by `shared-ux` and renaming the function would\nrequire code-reviews from too many teams to justify doing so in this PR.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"c45f791ddb3917fb13d978fc53a3a440bf9505b5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218361","number":218361,"mergeCommit":{"message":"[Unzyme] Migrates status_table of enzyme completely (#218361)\n\n## Summary\nfix #217589 again\nThe implementation in #217599 for\nthe status table still relied on enzyme indirectly by using\n`mountWithI18n`.\n\nThis PR refactors the test from implementing the enzyme-reliant helper\nto using `renderReactTestingLibraryWithI18n` that doesn't.\n\n## Note to reviewers:\nIf `renderReactTestingLibraryWithI18n` becomes the standard, renaming it\nto something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the\nhelper's only used in 13 files and it would be better to do so now that\nwhen adoption becomes wide-spread.\n\nThe package is owned by `shared-ux` and renaming the function would\nrequire code-reviews from too many teams to justify doing so in this PR.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"c45f791ddb3917fb13d978fc53a3a440bf9505b5"}}]}] BACKPORT--> Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
## Summary fix elastic#217589 again The implementation in elastic#217599 for the status table still relied on enzyme indirectly by using `mountWithI18n`. This PR refactors the test from implementing the enzyme-reliant helper to using `renderReactTestingLibraryWithI18n` that doesn't. ## Note to reviewers: If `renderReactTestingLibraryWithI18n` becomes the standard, renaming it to something shorter (e.g. `renderWithI18n`) would be nicer. ATM, the helper's only used in 13 files and it would be better to do so now that when adoption becomes wide-spread. The package is owned by `shared-ux` and renaming the function would require code-reviews from too many teams to justify doing so in this PR. ### Checklist Check the PR satisfies following conditions. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Fix #217589
Related to #217387
Migrates
metric_tilesandstatus_tableunit tests fromenzymesnapshot tests to explicit assertions usingRTL. Explicit assertions have the advantage of being more readable, targeted, reducing noise due to unrelated changes (e.g. EUI updates) and to make debugging easier.Checklist