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: Fix console errors about feature flags when running tests #21275

Merged
merged 2 commits into from
Sep 1, 2022

Conversation

codyml
Copy link
Member

@codyml codyml commented Aug 31, 2022

SUMMARY

#21201 added a console error if feature flags are read before initialization, but the Jest test environment doesn't include a feature flag initialization step, so all tests that render components that check feature flags were printing lots of these console errors (though still passing). This PR sets featureFlags to an empty object in the global window shim object used by Jest.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  • Run Jest tests and search the output for any console errors with "feature flag". After this update, there should be none.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #21275 (0f28ae8) into master (9c4ae2a) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #21275      +/-   ##
==========================================
- Coverage   66.44%   66.44%   -0.01%     
==========================================
  Files        1784     1784              
  Lines       68234    68236       +2     
  Branches     7265     7265              
==========================================
- Hits        45341    45336       -5     
- Misses      21024    21030       +6     
- Partials     1869     1870       +1     
Flag Coverage Δ
javascript 52.48% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset-frontend/src/featureFlags.ts 28.57% <0.00%> (-71.43%) ⬇️
superset-frontend/src/SqlLab/actions/sqlLab.js 61.05% <0.00%> (-0.33%) ⬇️
...d/src/SqlLab/components/SaveDatasetModal/index.tsx 52.87% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@michael-s-molina michael-s-molina 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 @codyml!

@michael-s-molina michael-s-molina merged commit 742dbdd into apache:master Sep 1, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants