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

add jest + react-testing library with example and docs guide #1246

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

balzss
Copy link
Contributor

@balzss balzss commented Aug 3, 2023

INSTUI-3818

  • add jest + react testing library to the project
  • add rules, config and script to run them
  • run with CI
  • convert ui-avatar tests as example and skip old ones
  • add guide to docs about converting tests

test plan

  • run new tests with yarn test:new -> all 26 should pass
  • run old ui-avatar tests with npx ui-scripts test --path packages/ui-avatar -> all 26 should be skipped (not including the theme related ones)
  • read the guide about tests here

@github-actions
Copy link

github-actions bot commented Aug 3, 2023

Preview URL: https://1246--preview-instui.netlify.app

@balzss balzss self-assigned this Aug 3, 2023
@balzss balzss changed the title WIP: add jest + react-testing library with examples add jest + react-testing library with example and docs guide Aug 8, 2023
@balzss balzss requested review from HerrTopi and matyasf August 8, 2023 10:58
Copy link
Collaborator

@matyasf matyasf left a comment

Choose a reason for hiding this comment

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

looking good, just some smaller issues

@@ -34,11 +34,14 @@
"prop-types": "^15.8.1"
},
"devDependencies": {
"@instructure/ui-axe-check": "workspace:^",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use here exact dependency numbers like with other internal references

preset: 'ts-jest',
testEnvironment: 'jsdom',
testMatch: ['**/__new-tests__/**/*.test.tsx']
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should calculate test coverage too (and later fail the build if its below 80%)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added the coverage threshold to the config. Once we are ready, we can add the --coverage flag to the script and it should work.

@balzss balzss requested a review from matyasf August 10, 2023 08:40
@balzss balzss force-pushed the feat/new-testing-libraries2 branch 2 times, most recently from 14cc9c2 to 90e5b92 Compare August 11, 2023 10:50
@balzss balzss force-pushed the feat/new-testing-libraries2 branch from 1d7777f to 88c775d Compare August 14, 2023 14:56
@balzss balzss merged commit 2c02c2a into master Aug 15, 2023
4 checks passed
@balzss balzss deleted the feat/new-testing-libraries2 branch August 15, 2023 08:13
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.

3 participants