-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Testing: Replace Mocha legacy methods with Jest alternatives #18695
Conversation
4ef7f0a
to
df82036
Compare
@skovhus - I see some improvements in how |
@gziolo so happy to hear. Please let me know which cases you needed to manual fix. Would be awesome if you could create an issue here https://github.com/skovhus/jest-codemods When looking at you tests it might makes sense to keep |
@skovhus it was this file: https://github.com/Automattic/wp-calypso/blob/4a6ff2c0d6c509996fe054a4c341f372683b193a/client/components/token-field/test/index.jsx - this link is to the version before I updated it manually. There are 2 root causes:
If you think it's something you want to fix, I can open an issue or comment on the existing one for Sinon.
It would be nice to have a choice, but honestly speaking, it's closer to the official docs. I'm fine with that as long as it's automated :) |
Thanks for explaining. Seems like rather special case... Was it hard to figure out what went wrong? |
It was very easy to fix. Cross-commented here: skovhus/jest-codemods#68 (comment). |
Thanks for letting me know. : ) |
Seeing the following integration test failures:
Should be pretty easy to replicate these failures by running EDIT: It looks like these tests fail on master too... Fixing this might be outside the scope of this PR. |
It's strange. It works locally for me even after I execute |
df82036
to
53610ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing Done:
- test-client
- test-server
- test-integration
Also I scanned through the first 20ish files and they all looked good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Well done! All tests suites passing here.
Thanks for review 💯 |
Another step to have tests API closer to Jest and therefore more consistent code.
This is an automated refactoring performed with
jest-codemods
assisted withprettier
run. It boils down to the following transformations:before
->beforeAll
after
->afterAll
context
->describe
it
->test
Testing
Make sure all existing tests pass:
npm run test-client
npm run test-integration
npm run test-server
Please note that linter fails in a few places, but all of them existed before. I don't plan to tackle those issues as part of this PR.