You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mistercrunch (via GitHub)" <gi...@apache.org> on 2026/04/10 18:10:14 UTC
[PR] fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure [superset]
mistercrunch opened a new pull request, #39280:
URL: https://github.com/apache/superset/pull/39280
### SUMMARY
Fixes flaky `ShareMenuItems.test.tsx` test suite that was intermittently crashing Jest workers in CI (sharded-jest-tests shard 3) with "Test suite failed to run" errors.
**Root causes:**
- **`window.location` leaked across suites** — Was deleted in `beforeAll` and only restored in `afterAll`. If the Jest worker reused the environment after a prior suite crash, `window.location` stayed deleted, causing setup failure.
- **`window.featureFlags` never cleaned up** — 5 tests set it but never removed it, leaking state to other suites in the same worker.
- **`fetchMock` routes accumulated** — Routes set once in `beforeAll`; the last test modified them without restoring. Stale route state could corrupt subsequent test runs.
- **Missing `await` on `userEvent.click()`** — Fire-and-forget clicks could race with async state updates.
**Fixes:**
- Move `window.location` setup/teardown to `beforeEach`/`afterEach` for per-test isolation
- Clean up `window.featureFlags` in `afterEach`
- Reset fetchMock routes and history in `beforeEach`/`afterEach`
- Add `await` to all `userEvent.click()` calls
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — test-only change
### TESTING INSTRUCTIONS
```bash
cd superset-frontend
npx jest src/dashboard/components/menu/ShareMenuItems/ShareMenuItems.test.tsx --no-coverage
```
All 10 tests should pass. The fix addresses non-deterministic failures that only manifest when Jest workers carry polluted state from prior test suites.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39280:
URL: https://github.com/apache/superset/pull/39280#issuecomment-4225997021
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39280?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.33%. Comparing base ([`aba7e6d`](https://app.codecov.io/gh/apache/superset/commit/aba7e6dae46f371142a884d4fed987dab47962a7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8143b4b`](https://app.codecov.io/gh/apache/superset/commit/8143b4b3bc8aae4656db1f3961cb2e550538f2ee?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 9 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #39280 +/- ##
=======================================
Coverage 64.33% 64.33%
=======================================
Files 2553 2553
Lines 132461 132461
Branches 30720 30720
=======================================
Hits 85218 85218
Misses 45757 45757
Partials 1486 1486
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/39280/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/39280/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.96% <ø> (ø)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/39280?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch merged PR #39280:
URL: https://github.com/apache/superset/pull/39280
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39280:
URL: https://github.com/apache/superset/pull/39280#issuecomment-4225792373
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39280:
URL: https://github.com/apache/superset/pull/39280#issuecomment-4226287313
**Bito Automatic Review Skipped – PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #39280:
URL: https://github.com/apache/superset/pull/39280#issuecomment-4225802201
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 678c1b27572738b6d8e4ed492be0e865edae60d0 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69d93d07f4a4ab0008d999b5 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-39280--superset-docs-preview.netlify.app](https://deploy-preview-39280--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-39280--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org