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

Adding tree-shaking test #135

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Adding tree-shaking test #135

wants to merge 3 commits into from

Conversation

peripateticus
Copy link
Member

@peripateticus peripateticus commented May 9, 2023

Description

In #131, Cedar was updated to be tree-shakeable, this PR follows up on that and adds unit test to ensure tree-shaking is working as expected.

What this test does:

  • builds Cedar,
  • builds an app that imports CdrButton from dist/lib.mjs ,
  • verifies that only CdrButton is in the app bundle.

Implementation notes:

  • In the test, I’m re-building Cedar rather than requiring that a build happen prior to running the unit tests. Test can run independently of a build. This results in a longer running test so I had to bump the test timeout.
  • I’m building to a separate dist directory, /dist-test and import from that in the test app so that we aren’t overwriting Cedar’s default /dist directory.
  • I’m exporting the raw config object from vite.config.mjs because I need to update values prior to the defineConfig call, then I call defineConfig within the test.

Checklist:

Design:

  • Reviewed with designer and meets expectations

Cross-browser testing:

  • Chrome
  • Firefox
  • Edge
  • Safari
  • iOS
  • Android

Unit testing:

  • Sufficient unit test coverage (see unit test best practices for ideas)
  • Snapshot updates are explained with comment and reference the relevant source code change

A11y:

  • Meets WCAG AA standards

Documentation:

  • API docs created/updated
  • Examples created/updated

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.

None yet

1 participant