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

chore: add setup for tests #6

Merged
merged 4 commits into from
Dec 4, 2020
Merged

chore: add setup for tests #6

merged 4 commits into from
Dec 4, 2020

Conversation

vickyyyyyyy
Copy link
Member

@vickyyyyyyy vickyyyyyyy commented Dec 4, 2020

Basic set up for tests.

Ran into a bunch of issues related to the test config setup while adding tests so thought it would be good to have this as a separate PR to isolate this out.

Tested the test config with basic test (the test is not included in the PR because it was just for testing):
Screenshot 2020-12-04 at 10 25 45

The config fixes the following errors:

  • Canvas not implemented error (some UI components require this)
    Screenshot 2020-12-04 at 10 31 38

Solution: use jest-canvas-mock in our jest config (example copied from grafana)

  • When trying to import a UI component that uses hooks:
    Screenshot 2020-12-04 at 10 26 05

Solution: ensure we are using only one version of React (done in the moduleNameWrapper) of the jest config

  • Parsing import statements
    Screenshot 2020-12-04 at 10 26 23

Solution: use @babel/preset-env

  • Some issue with jsx
    Screenshot 2020-12-04 at 10 27 34

Solution: use @babel/preset-react

  • Parsing interface keyword
    Screenshot 2020-12-04 at 10 50 48

Solution: use @babel/preset-typescript

Other than the above, also added:

@vickyyyyyyy vickyyyyyyy requested a review from a team December 4, 2020 10:39
Copy link
Member

@srclosson srclosson left a comment

Choose a reason for hiding this comment

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

Love the very thorough commenting and description Vicky! I'm approving, but would really like to see an actual test case? Or perhaps a couple of examples that devs could copy/paste?

@vickyyyyyyy
Copy link
Member Author

Love the very thorough commenting and description Vicky! I'm approving, but would really like to see an actual test case? Or perhaps a couple of examples that devs could copy/paste?

added this in now: https://github.com/grafana/ui-enterprise/pull/6/files#diff-ef8720d9b89d69da32936aeb4b884741df3e77043cecec6ce47ff72d7aaf91a6 😎

@vickyyyyyyy vickyyyyyyy merged commit 57634a8 into master Dec 4, 2020
@vickyyyyyyy vickyyyyyyy deleted the setup-tests branch December 4, 2020 13:14
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

2 participants