Skip to content

fix: expose test utils#1890

Merged
Stephen Watkins (stephenjwatkins) merged 2 commits into
mainfrom
expose-test-utils
Jun 15, 2026
Merged

fix: expose test utils#1890
Stephen Watkins (stephenjwatkins) merged 2 commits into
mainfrom
expose-test-utils

Conversation

@stephenjwatkins

@stephenjwatkins Stephen Watkins (stephenjwatkins) commented Jun 12, 2026

Copy link
Copy Markdown
Member

📝 Changes

  • Updates vite packaging to include test utils so that we can use some common mocks in consumers
  • Fixes act() warnings

✅ Checklist

Easy UI has certain UX standards that must be met. In general, non-trivial changes should meet the following criteria:

  • Visuals match Design Specs in Figma
  • Stories accompany any component changes
  • Code is in accordance with our style guide
  • Design tokens are utilized
  • Unit tests accompany any component changes
  • TSDoc is written for any API surface area
  • Specs are up-to-date
  • Console is free from warnings
  • No accessibility violations are reported
  • Cross-browser check is performed (Chrome, Safari, Firefox)
  • Changeset is added

Strikethrough any items that are not applicable to this pull request.

Build src/utilities/test.ts into dist so consumers can import easy-ui's
test helpers via @easypost/easy-ui/utilities/test:

- vite.config.mts: include test.ts in the build glob (still excluding
  *.test.ts) and externalize vitest + @testing-library/* so they are
  resolved from the consumer rather than bundled. react-transition-group
  stays bundled so disable/enableReactTransitionGroup share easy-ui's
  config instance.
- test.ts: drop the ambient `declare global` block (it would leak
  `var jest` / `IS_REACT_ACT_ENVIRONMENT` into consumers and collide with
  @types/jest); access the jest global via a local cast instead.
- vitest.setup.ts: move the IS_REACT_ACT_ENVIRONMENT declaration here,
  where it is set; this file is outside the build so it does not ship.

Also fix the "testing environment is not configured to support act(...)"
warnings: user-event v14 wraps interactions in act() internally, so the
manual act() wrappers in userClick/userTab/etc. and in the Tooltip test
helpers caused nested-act flag thrashing under fake timers. Remove the
redundant wrappers; wrap only the synchronous timer flush.
@stephenjwatkins
Stephen Watkins (stephenjwatkins) marked this pull request as ready for review June 12, 2026 16:34
Comment on lines +58 to +60
"vitest",
"@testing-library/react",
"@testing-library/user-event",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't want to bundle these, just rely on the consumer having it, if wanting our test utilities.

@stephenjwatkins
Stephen Watkins (stephenjwatkins) merged commit 1774142 into main Jun 15, 2026
6 checks passed
@stephenjwatkins
Stephen Watkins (stephenjwatkins) deleted the expose-test-utils branch June 15, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants