-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[pigment-css] Improve testing of fixtures #41389
Conversation
Netlify deploy previewhttps://deploy-preview-41389--material-ui.netlify.app/ Bundle size report |
1cc1377
to
a6df0ba
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.
@brijeshb42 I split the pigment.test.ts
into features and create a testUtils.ts
file to reuse the transformation logic. It lets me run a specific test with it.only
and the applying a theme per test.
const CUSTOM_ERROR = | ||
'The file contents have changed. Run "test:update" command to update the file if this is expected.'; | ||
|
||
describe('Pigment CSS - styled', () => { |
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.
All the test files are repetitive in code. Only thing that is changing is the file path.
Creating new tests means copying the same content everytime. This was already solved in the previous implementation.
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.
Added a comment above that'll handle duplication while still keeping the tests independent.
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.
Creating new tests means copying the same content everytime. This was already solved in the previous implementation.
I'd argue this. The previous implementation does not let me use the test infra APIs like it.only()
to run a specific test. Also, a specific theme for each test is not possible.
This made me think of The wrong abstraction. The agree that there are duplications but the tests should also be flexible to add/remove/alter as well.
cc @mnajdova for 3rd opinion.
Now, no need to manually create and write to files. If the output files don't exist, they'll be created with the expected content. If the contents itself change, use "test:update" command to automatically update the fixtures.
c7b35e5
to
540871b
Compare
Co-authored-by: siriwatknp <siriwatkunaporn@gmail.com>
Now, no need to manually create and write to files. If the output files don't exist, they'll be created with the expected content.
If the contents itself change, use "test:update"
command to automatically update the fixtures.