Skip to content

Move IS_JEST_ENVIRONMENT src/test -> src/utils#5655

Merged
chandlerprall merged 2 commits intoelastic:mainfrom
chandlerprall:5605-move-isjest-check-from-test
Feb 22, 2022
Merged

Move IS_JEST_ENVIRONMENT src/test -> src/utils#5655
chandlerprall merged 2 commits intoelastic:mainfrom
chandlerprall:5605-move-isjest-check-from-test

Conversation

@chandlerprall
Copy link
Copy Markdown
Contributor

Summary

Fixes #5605

Traditionally, the src/test directory was meant to include helpers specific to unit tests, and while these are included in EUI's npm distribution, only importable through @elastic/eui/es/test or @elastic/eui/lib/test. When I added IS_JEST_ENVIRONMENT for the data grid checks, I added it to the src/test directory even though it is consumed by non-test source code, breaking that tradition. It's moved around a bit since then, but has made its way back to src/test which broke the environment described in #5606.

This PR moves IS_JEST_ENVIRONMENT to src/utils to align with the rest of the codebase's organization. I also added a readme file for the test directory to re-set those expectations and document the baseline of those helpers (most of them, I omitted a few that we should probably just delete, but didn't want to conflate this change).

Skipping the changelog on this because it doesn't feel impactful to the setups we specifically support, but that's only my opinion.

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in Chrome, Safari, Edge, and Firefox
- [ ] Props have proper autodocs and playground toggles

  • Added documentation
    - [ ] Checked Code Sandbox works for any docs examples
    - [ ] Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
    - [ ] A changelog entry exists and is marked appropriately

@chandlerprall chandlerprall added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Feb 22, 2022
Copy link
Copy Markdown
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Looks good to me! Long term I think we should consider moving away from IS_JEST_ENVIRONMENT to testenv mocks, but if/when we do we can just delete the entire util if only datagrid is using it

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_5655/

@chandlerprall chandlerprall merged commit 3cf98ca into elastic:main Feb 22, 2022
@chandlerprall chandlerprall deleted the 5605-move-isjest-check-from-test branch February 22, 2022 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrading @elastic/eui from 40.1.0 to 41+, cannot find module ../../../test

3 participants